Mutation-Guided Unit Test Generation with a Large Language Model
Authors
AI Summary
Sign in to view the AI-generated summary, key takeaways, and more.
Sign in to viewAbstract
Unit tests play a vital role in uncovering potential faults in software. While tools like EvoSuite focus on maximizing code coverage, recent advances in large language models (LLMs) have shifted attention toward LLM-based test generation. However, code coverage metrics -- such as line and branch coverage -- remain overly emphasized in reported research, despite being weak indicators of a test suite's fault-detection capability. In contrast, mutation score offers a more reliable and stringent measure, as demonstrated in our findings where some test suites achieve 100% coverage but only 4% mutation score. Although a few studies consider mutation score, the effectiveness of LLMs in killing mutants remains underexplored. In this paper, we propose MUTGEN, a mutation-guided, LLM-based test generation approach that incorporates mutation feedback directly into the prompt. Evaluated on 204 subjects from two benchmarks, MUTGEN significantly outperforms both EvoSuite and vanilla prompt-based strategies in terms of mutation score. Furthermore, MUTGEN introduces an iterative generation mechanism that pushes the limits of LLMs in killing additional mutants. Our study also provide insights into the limitations of LLM-based generation, analyzing the reasons for live and uncovered mutants, and the impact of different mutation operators on generation effectiveness.
Related Papers
Quantum Approximate Optimization Algorithm for Test Case Optimization
Test case optimization (TCO) reduces software testing cost while preserving its effectiveness, but solving TCO problems for
Learning Randomized Reductions
A self-corrector for a function $f$ takes a black-box oracle computing $f$ that is correct on most inputs and turns it into one that is correct on every input with high
Are We Learning the Right Features? A Framework for Evaluating DL-Based Software Vulnerability Detection Solutions
Recent research has revealed that the reported results of an emerging body of DL-based techniques for detecting software
Challenges and Practices in Quantum Software Testing and Debugging: Insights from Practitioners
Quantum software engineering is an emerging discipline with distinct challenges, particularly in testing and debugging. As quantum computing