TY - GEN
T1 - Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests
AU - Deljouyi, Amirhossein
AU - Koohestani, Roham
AU - Izadi, Maliheh
AU - Zaidman, Andy
PY - 2025
Y1 - 2025
N2 - Automated unit test generators, particularly searchbased software testing tools like EvoSuite, are capable of generating tests with high coverage. Although these generators alleviate the burden of writing unit tests, they often pose challenges for software engineers in terms of understanding the generated tests. To address this, we introduce UTGen, which combines searchbased software testing and large language models to enhance the understandability of automatically generated test cases. We achieve this enhancement through contextualizing test data, improving identifier naming, and adding descriptive comments. Through a controlled experiment with 32 participants from both academia and industry, we investigate how the understandability of unit tests affects a software engineer's ability to perform bug-fixing tasks. We selected bug-fixing to simulate a real-world scenario that emphasizes the importance of understandable test cases. We observe that participants working on assignments with UTGen test cases fix up to 33% more bugs and use up to 20% less time when compared to baseline test cases. From the post-test questionnaire, we gathered that participants found that enhanced test names, test data, and variable names improved their bugfixing process.
AB - Automated unit test generators, particularly searchbased software testing tools like EvoSuite, are capable of generating tests with high coverage. Although these generators alleviate the burden of writing unit tests, they often pose challenges for software engineers in terms of understanding the generated tests. To address this, we introduce UTGen, which combines searchbased software testing and large language models to enhance the understandability of automatically generated test cases. We achieve this enhancement through contextualizing test data, improving identifier naming, and adding descriptive comments. Through a controlled experiment with 32 participants from both academia and industry, we investigate how the understandability of unit tests affects a software engineer's ability to perform bug-fixing tasks. We selected bug-fixing to simulate a real-world scenario that emphasizes the importance of understandable test cases. We observe that participants working on assignments with UTGen test cases fix up to 33% more bugs and use up to 20% less time when compared to baseline test cases. From the post-test questionnaire, we gathered that participants found that enhanced test names, test data, and variable names improved their bugfixing process.
KW - Automated Test Generation
KW - Large Language Models
KW - Readability
KW - Understandability
KW - Unit Testing
UR - https://www.scopus.com/pages/publications/105010300945
U2 - 10.1109/ICSE55347.2025.00032
DO - 10.1109/ICSE55347.2025.00032
M3 - Conference contribution
AN - SCOPUS:105010300945
T3 - Proceedings - International Conference on Software Engineering
SP - 1449
EP - 1461
BT - Proceedings - 2025 IEEE/ACM 47th International Conference on Software Engineering, ICSE 2025
PB - IEEE
CY - New York, NY
T2 - 47th IEEE/ACM International Conference on Software Engineering, ICSE 2025
Y2 - 27 April 2025 through 3 May 2025
ER -