Abstract
The rapid evolution of Large Language Models (LLMs) has strongly impacted software engineering, leading to a growing number of studies on automated unit test generation. However, the standalone use of LLMs without post-processing has proven insufficient, often producing tests that fail to compile or achieve high coverage. Several techniques have been proposed to address these issues, reporting improvements in test compilation and coverage. While important, LLM-based test generation techniques have been evaluated against relatively weak baselines (for today's standards), i.e., old LLM versions and relatively weak prompts, which may exacerbate the performance contribution of the approaches. In other words, stronger (newer) LLMs may obviate any advantage these techniques bring. We investigate this issue by replicating four state-of-the-art LLM-based test generation tools, HITS, SymPrompt, TestSpark, and CoverUp that include engineering components aimed at guiding the test generation process through compilation and execution feedback, and evaluate their relative effectiveness and efficiency over a plain LLM test generation method. We integrate current LLM versions in all approaches and run an experiment on 393 classes and 3,657 methods. Our results show that the plain LLM approach can outperform previous state-of-the-art approaches in all test effectiveness metrics we used: line coverage (by 17.72%), branch coverage (by 19.80%) and mutation score (by 20.92%), and it does so at a comparable cost (LLM queries). We also observe that the granularity at which the plain LLM is applied has a significant impact on the cost. We therefore propose targeting first the program classes, where test generation is more efficient, and then the uncovered methods to reduce the number of LLM requests. This strategy achieves comparable (slightly higher) effectiveness while requiring about 20% fewer LLM requests.
Introduction
When LLMs first emerged, they struggled with the precision required for unit testing, often generating code that failed to compile or missed complex edge cases. To compensate, researchers developed sophisticated pipelines like HITS and SymPrompt, which use symbolic execution and code slicing to guide the model. However, as models like GPT-4o-mini and Llama 3.3 have matured, their native reasoning capabilities have improved significantly. This study asks whether these complex "training wheels" are still necessary or if they now hinder the performance of modern, more capable models.
Methodology
We evaluated four state-of-the-art (SOTA) tools—HITS, SymPrompt, TestSpark, and CoverUp—against a "Plain-LLM" baseline. The Plain-LLM approach utilizes a simple zero-shot prompt to generate tests for a class or method, followed by a basic 5-iteration repair loop. This loop feeds compiler and execution errors back to the model to iteratively fix the generated code.
To ensure the validity of our findings and avoid data contamination, we selected six open-source Java repositories created after October 2023. This ensures that the models, such as Llama 3.3 (70B) and DeepSeek V3, were tested on code they had not encountered during their initial training phases.
Key Results and Effectiveness
Our findings indicate that the simpler Plain-LLM approach, when applied at the method level, consistently outperforms heavily engineered SOTA tools across all primary metrics. As shown in the data, the Plain-LLM (Method) achieved a total line coverage of 49.95%, significantly higher than the 42.43% achieved by HITS, the best-performing SOTA tool.
In terms of efficiency, the Plain-LLM approach is also superior. While HITS required 23,865 API queries to complete its testing cycle, the Plain-LLM (Method) required only 11,718 queries. This suggests that the complex prompt engineering and static analysis used by older tools may actually be counterproductive when paired with modern LLMs.
The Granularity Challenge and Hybrid Solution
We observed a clear trade-off between efficiency and thoroughness based on the granularity of the prompt. Class-level generation is fast and cheap but often misses deep logic. Method-level generation is thorough but expensive. To address this, we propose a Hybrid approach: generate tests at the class level first to capture broad coverage, then target only the remaining uncovered methods. This strategy maintains high effectiveness while reducing the total number of LLM requests by approximately 20%.
Discussion and Limitations
Despite these improvements, LLM-based test generation remains imperfect. We observed "Lazy LLM" behavior, where models generate empty placeholder classes or hallucinate interfaces to bypass compiler errors rather than fixing the underlying test logic. Currently, only about 40–50% of generated tests pass both compilation and execution. Future research should focus on refining automated test-repair mechanisms and constraining LLM "creativity" to ensure generated tests are both valid and meaningful.
Summary updated