Large-scale, Independent and Comprehensive study of the power of LLMs for test case generation
Abstract
Unit testing is essential for software reliability, yet manual test creation is time-consuming and often neglected. Search-based software testing improves efficiency but produces tests with poor readability and maintainability, while LLMs show promise but lack comprehensive evaluation across reasoning-based prompting and real-world scenarios. This study presents the first large-scale empirical evaluation of LLM-generated unit tests at the full class level, analyzing four models (GPT-3.5, GPT-4, Mistral 7B, and Mixtral 8x7B) against EvoSuite across 216,300 test cases targeting Defects4J, SF110, and CMD. We evaluate five prompting techniques, ZSL, FSL, CoT, ToT, and GToT, assessing compilability, hallucination-driven failures, readability, coverage, and test smells. Reasoning-based prompting, particularly GToT, significantly enhances reliability and compilability, yet hallucination-driven failures remain persistent, with compilation failure rates reaching 86%. While LLM-generated tests are generally more readable than SBST outputs, recurring issues such as Magic Number Tests and Assertion Roulette hinder maintainability. These findings suggest that hybrid approaches combining LLM-based generation with automated validation and search-based refinement are necessary for production-ready results.
Cite
@article{arxiv.2407.00225,
title = {Large-scale, Independent and Comprehensive study of the power of LLMs for test case generation},
author = {Wendkûuni C. Ouédraogo and Kader Kaboré and Yinghua Li and Haoye Tian and Anil Koyuncu and Jacques Klein and David Lo and Tegawendé F. Bissyandé},
journal= {arXiv preprint arXiv:2407.00225},
year = {2026}
}
Comments
Accepted at Empirical Software Engineering (EMSE) journal on 3 March 2026