Mutation-Guided Unit Test Generation With a Large Language Model
Guancheng Wang, Qinghua Xu, Lionel Briand, Kui Liu
University of Limerick · University of Ottawa
Key points
From the paper's conclusion- Our study also provides 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.
Abstract
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 scoreoffers 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 provides 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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)Proceedings of the ACM on software engineering. · 2026
- Beyond Coverage: Automatic Test Suite Augmentation for Enhanced Effectiveness using Large Language ModelsProceedings of the ACM on Programming Languages · 2026
- Test vs Mutant: Adversarial LLM Agents for Robust Unit Test GenerationProceedings of the ACM on software engineering. · 2026
- A Comprehensive Study on Large Language Models for Mutation TestingACM Transactions on Software Engineering and Methodology · 2026
- MuMuTestUp: Mutation-Based Multi-agent Test Case UpdateProceedings of the ACM on software engineering. · 2026
- Evaluating and Mitigating the Misguidance Effect of Buggy Code in LLM-Generated Unit TestsProceedings of the ACM on software engineering. · 2026