Improving the Readability of Automatically Generated Tests using Large Language Models
Matteo Biagiola, Gianluca Ghislotti, Paolo Tonella

TL;DR
This paper presents a method that enhances the readability of automatically generated tests by improving variable and test names using large language models, while maintaining their original effectiveness in code coverage.
Contribution
It introduces a technique to improve test readability by refining names in search-based generated tests using LLMs without sacrificing coverage.
Findings
Readability of tests improved to match developer-written tests
Semantic preservation of test semantics confirmed across multiple runs
Human study shows tests are as readable as those written by developers
Abstract
Search-based test generators are effective at producing unit tests with high coverage. However, such automatically generated tests have no meaningful test and variable names, making them hard to understand and interpret by developers. On the other hand, large language models (LLMs) can generate highly readable test cases, but they are not able to match the effectiveness of search-based generators, in terms of achieved code coverage. In this paper, we propose to combine the effectiveness of search-based generators with the readability of LLM generated tests. Our approach focuses on improving test and variable names produced by search-based tools, while keeping their semantics (i.e., their coverage) unchanged. Our evaluation on nine industrial and open source LLMs show that our readability improvement transformations are overall semantically-preserving and stable across multiple…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Text Readability and Simplification
