Editor’s introduction
The study evaluates four established LLM-based test generation techniques—HITS, SymPrompt, TestSpark, and CoverUp—against a plain LLM baseline using current LLM versions. The effectiveness of the plain approach is sensitive to the granularity of application, with better results when first targeting program classes before moving to uncovered methods.
Introduction
Recent advances in AI, driven by powerful Large Language Models (LLMs), have revolutionized Software Engineering tasks, including code generation, vulnerability detection, program repair, and more recently, automatic test generation. Despite suboptimal LLM performance (e.g., hallucination), the effectiveness of LLM-based test generation techniques has been significantly improved by combining advanced prompting strategies (e.g., Chain-of-Thought and Self-Consistency) and retrieval augmentation with traditional software engineering techniques, such as code coverage and symbolic execution.
All these techniques were effective to mitigate the limitations of LLMs at that time, mainly GPT 3.5. Considering that recent LLMs have improved their reasoning skills, adaptability to various tasks (Mixture-of-Experts) and increased computational efficiency, we raise the question whether the existing LLM-Based test generation techniques remain effective or rather become obsolete, and just by using simple prompting the LLM can produce quality test suites.
To answer this question, we evaluate four LLM-based test generation techniques for Java programs (HITS, SymPrompt, TestSpark and Coverup ), representative of the state-of-the-art in terms of effectiveness and diversity of the underlying techniques. In addition, we include LLM-Plain, a zero-shot simple prompting baseline. All five approaches are executed on the latest available models, namely GPT-4o-mini, Llama 3.3 70B, and DeepSeek V3. We carefully selected 6 Java projects, by considering the training date of the models, and run the five approaches to generate test cases on the entire project (i.e., on every class under test). We compare the performance of the aforementioned approaches on three dimensions.
Perhaps surprising, our results show that LLMs can produce relatively effective test suites, outperforming the four state-of-the-art tools. Plain-LLM obtains, in total, 49.95%, 35.33%, and 33.82% on line/branch/mutation coverage, while HITS obtains 42.43%, 29.49%, and 27.97%, SymPrompt 40.95%, 27.19%, and 28.40%, TestSpark 23.65%, 16.48%, and 13.88%, and CoverUP 38.85%, 25.11%, and 26.26%, respectively. This indicates that with new, relatively strong LLMs, test generation methods provide a limited or no advantage to the generation process.
Our results also show that, across the three LLMs used on the experiments, SymPrompt was the least costly tool to run, making 5,602 requests to the LLMs, on average, followed by TestSpark with 7,023 requests, Plain-LLM with 11,815, CoverUP 12,741, and finally HITS, the most costly approach, with 16,735 requests.
Background and Related Work
ChatTester is one of the first studies that used LLMs to generate unit tests. ChatTester instructs the LLMs to generate tests for a given class and then iteratively improves them by providing feedback (the compiler error message) every time an error is thrown, i.e., when the test is not compiling. This scheme improves the test suites by generating 34.30% more compiling tests and 18.7% more passing tests. This feedback-driven test repair loop was later adopted by many LLM-based unit test generators. For instance, ChatUniTest includes a test repair mechanism for simple syntactic errors such as imports and missing semicolons, which are taken from the compilation error message.
TestART is another technique that uses template-based and re-prompting to perform test compilation fixing. It relies on five templates to fix common compilation issues. TestSpark aims to enrich the prompts with some context, i.e., by including the class under test together with the relevant parent classes. CoverUp introduced the idea of providing coverage feedback, i.e., uncovered code, to LLMs so that they can effectively generate tests for uncovered code.
SymPrompt prompts LLMs with information drawn from traditional symbolic execution. SymPrompt statically analyzes a method to identify all feasible execution paths, and then prompts the LLM to generate a corresponding test case for each path. PANTA identifies uncovered code segments and iteratively prompts the LLMs with candidate execution paths as the target.
HITS is a tool that goes deeper into a method before generating tests through slicing. Using the ”Chain of Thought” prompting strategy, it instructs the LLM to decompose a given method into smaller, logically coherent code blocks known as slices. It then prompts the model to generate a corresponding test class for each slice.
TELPA computes a call graph to identify methods’ sequence calls that are then used as context in the prompt for test generation. There are also some approaches aiming to generate unit tests to kill mutants. Notably, Mutap, ACH, PRIMG are some of the approaches that have been used to generate unit tests to improve the mutation score of generated tests. These approaches differ from the above ones by providing mutation feedback (live mutants) instead of code coverage.
Projects used
For our experiments, we selected six complete open-source Java repositories, representing, to the best of our knowledge, the largest dataset used to date in studies of LLM-based test generation for Java. We selected repositories previously used in LLM-based test generation studies, including those employed for evaluating ChatUniTest and HITS, as well as the GitBug-Java dataset. To reduce the risk of data contamination, we deliberately chose repositories such that half are not included in the model’s training set. To distinguish between seen and unseen data, we applied the model’s announced cutoff date, classifying all projects created after October 1, 2023, as unseen. Table I shows the projects used and the repositories that might be included in the LLM’s training set.
Unlike prior studies, which typically evaluate only a subset of classes or methods, our evaluation encompasses all classes within each repository. This comprehensive approach avoids introducing bias through selective sampling and ensures that no approach is inadvertently favored.
LLM-based unit test generators
TestSpark can use either traditional test generation via EvoSuite or LLM-based test generation. When employing LLMs, TestSpark prompts the model to generate test cases targeting 100% coverage for the entire class or method under test. Additionally, if the class under test inherits from a parent class, TestSpark includes the corresponding parent class code in the prompt. In our experiments, we exclusively used the LLM-based configuration, since we evaluate LLM-based tools previously assessed with earlier model versions.
CoverUp extends prior test generation workflows by introducing an additional coverage augmentation phase. After generating an initial test suite, CoverUp measures code coverage, identifies uncovered lines, and subsequently guides the LLM to generate additional tests targeting the remaining uncovered code.
Although further approaches have been tried so far, we did not include every approach into our evaluation either because the approach does not contain a publicly available implementation (e.g. ASTER ), or simply because they have not been evaluated with older versions of the LLMs of this evaluation study (e.g. PANTA ). Additionally, certain approaches, such as ChatTester, were excluded despite having been evaluated with earlier versions of our chosen LLMs, as they have been consistently outperformed by one or more of the selected baseline tools.
RQ1: Effectiveness
Based on the line coverage results, the Plain-LLM approach consistently outperforms all previously proposed techniques in total and average coverage. Although Plain-LLM does not achieve the highest coverage in every individual repository, its performance remains consistently comparable across projects, resulting in the highest overall effectiveness.
For branch coverage, HITS achieves the highest coverage in the majority of individual repositories; however, when aggregating results across the entire dataset, Plain-LLM covers a larger total number of branches. On average, the differences among Plain-LLM, HITS, and SymPrompt are modest. Regarding mutation testing, Plain-LLM again emerges as the most effective approach in terms of total mutation score, with SymPrompt ranking second.
Overall, these results indicate that even without sophisticated error parsing or extensive engineering, a Plain-LLM approach that relies primarily on the inherent capabilities of large language models can outperform prior techniques in terms of line coverage and mutation score, while achieving comparable performance in branch coverage.
Generalization on multiple LLMs
To assess whether our findings generalize beyond the primary model under evaluation, we replicated our experiments using two additional large language models: DeepSeek V3 and LLaMA 3.3 (70B). These models were selected because they belong to different model families and represent state-of-the-art capabilities in large-scale code generation.
It is important to note, however, that the two models differ in their announced training data cutoff dates. LLaMA 3.3 reports a cutoff of December 2023, whereas DeepSeek V3 reports a substantially later cutoff of December 2024. As a result, DeepSeek V3 may have been exposed to the full set of projects used in our evaluation.
We can also observe that the number of requests done by TestSpark, CoverUP, and the Plain-LLM (method and class granularity), remain consistent throughout the different LLMs. HITS, however, performed many more requests to the LLM when gpt-4o-mini is used, which explains why its performance is higher under this specific LLM.
Method and Class Granularity Complementarity
Although the generated class-level suites may look less effective than the method-level ones, we observed that these are indeed complementary. We merged the passing tests generated at the class-level and method-level from the previous experiment into a single test suite.
As shown in Table IV, this combined suite consistently achieves higher coverage across all evaluated code coverage metrics. This observation indicates that the two approaches are complementary. While method-level prompting tends to produce more fine-grained and in-depth tests, class-level prompting enables the model to exercise code outside individual methods, thereby improving overall coverage.
Nonetheless, combining class-level and method-level test suites requires a substantially higher cost in terms of generated tests and execution time, and increases the likelihood of duplicate tests. To address these limitations, we propose a hybrid approach that integrates the strengths of both workflows while improving efficiency. The hybrid approach initially applies class-level test generation and subsequently invokes method-level test generation only for methods that are not fully covered at the branch level. In other words, method-level testing is selectively applied to insufficiently covered methods.
When it comes to efficiency though, our findings show that the hybrid approach is more optimized. In table VIII we observe that hybrid approach requires fewer queries to the LLM and used approximately half the number of tests compared to the combined approach. Furthermore, hybrid approach not only outperformed the combined test suite, but it was even more efficient than using only method-level testing.
Fixing syntactically invalid tests
Our findings indicate that a substantial number of generated tests are discarded because they either fail to compile or do not pass, potentially due to incorrectly generated oracles. Averaging across all evaluated models, we found that at the class level, only 78.89% of tests successfully compiled, while on method level about 82,17%. In other words, an average of 854 tests per model were discarded at the class level, and 2,683 tests per model at the method level.
Similarly, the prevalence of non-passing tests cannot be overlooked, as on average approximately half of the generated tests fail, thereby reducing the overall effectiveness of the generated test suite. Perhaps the primary reason for the failure of otherwise compiling tests appears to be incorrectly generated oracles. Using LLMs for test oracle generation is a research challenge in its own, with distinct advantages and limitations. Nonetheless, some approaches have already combined traditional test generation techniques with LLM-based oracle generation. A dedicated line of research that integrates an oracle generation mechanism into LLM-based test generation tools could substantially improve the quality and effectiveness of the generated tests.
Hybrid approach: Leveraging granularity
Our experiments show that granularity has a significant impact on effectiveness, as method-level prompting makes LLMs to generate more tests and cover a greater number of execution paths. At the same time, the two approaches (class-level and method-level) do not replace each other, but rather complement one another. However, while combining class-level and method-level approaches is effective, it is relatively cost-inefficient, requiring a high number of LLM queries and increasing the likelihood of generating duplicate tests.
In our case study, we observed that the Hybrid approach achieves effectiveness comparable to the combined approach while substantially reducing LLM query cost, despite our current implementation not being fully optimized. Moreover, whereas prior approaches in our evaluation primarily rely on method-level testing, our findings indicate that the Hybrid approach can be even more efficient than method-level testing alone. On average across all evaluated models, the Hybrid approach required 2,259 fewer LLM queries than method-level testing, which is the strategy employed by current approaches. These results highlight the need for further research on efficiently combining multiple levels of granularity to maximize effectiveness and efficiency.
Threads to Validity
External validity: A potential threat to the validity of this study concerns the tools used for comparison. To mitigate this risk, we relied on ChatUniTest, a widely adopted plugin that implements all the algorithms included in our evaluation. This tool has been employed in previous studies, including evaluations of LLM-based test generation approaches. In addition, we evaluated multiple LLMs from different model families to ensure that our findings are consistent and generalizable.
Internal validity: The performance of our implementation depends on the underlying LLMs. Accordingly, a potential threat to validity arises from variations in model capability as well as from the nondeterministic nature of LLM outputs. To mitigate these threats, we evaluated multiple models from different families, reducing the risk that our findings are specific to a single model. Additionally, to limit nondeterminism, we configured all models with a low temperature setting (0.1), aiming to make the generation process as deterministic as possible.
Construct validity: A potential threat to the validity of this study is data leakage, that is, whether the LLM has already been exposed to our evaluation set during training. To mitigate this threat, we selected repositories previously used in studies on LLM-based test generation, as well as the GitBug-Java dataset. Additionally, we manually inspected the creation date of each repository included in our experimental setup and labeled them accordingly to distinguish between seen and unseen data.
Conclusion
In this study, we investigated the performance of existing LLM-based test generation approaches when evaluated on newer LLM versions than those used in their original assessments. We also implemented a simple Plain-LLM baseline that relies exclusively on the capabilities of the LLM, employing minimal output post-processing and no error handling or sophisticated engineering mechanisms.
Our findings indicate that simple prompting via Plain-LLM can outperform the four state-of-the-art tools included in our evaluation. Plain-LLM achieved higher total and average coverage than all prior approaches across most metrics, with the only exception being that HITS slightly outperformed Plain-LLM on average branch coverage. Regarding efficiency, Plain-LLM demonstrated comparable performance.
We further examined the impact of prompting granularity on LLM-based test generation. Our findings show that method-level prompting leads LLMs to generate a larger number of tests and to exercise methods more thoroughly than class-level prompting. To explore whether these two strategies can be combined, we evaluated their joint use and found them to be complementary. Building on this observation, we demonstrated that a hybrid approach that leverages both class-level and method-level workflows can improve the cost-effectiveness of test generation, outperforming method-level prompting alone as well as the naïve combination of their respective test suites.
Finally, we demonstrated that these results generalize across multiple LLMs of different families. In addition, we observed that LLM-based test generation techniques suffer from a large number of syntactical invalid tests, as under class level, only 78.89% of tests successfully compiled, while on method level about 82,17%.


