An Exploratory Study on Using Large Language Models for Mutation Testing
<|reference_start|>An Exploratory Study on Using Large Language Models for Mutation Testing: Mutation testing is a foundation approach in the software testing field, based on automatically seeded small syntactic changes, known as mutations. The question of how to generate high-utility mutations, to be used for testing purposes, forms a key challenge in mutation testing literature. Large Language Models (LLMs) have shown great potential in code-related tasks but their utility in mutation testing remains unexplored. To this end, we systematically investigate the performance of LLMs in generating effective mutations w.r.t. to their usability, fault detection potential, and relationship with real bugs. In particular, we perform a large-scale empirical study involving six LLMs, including both state-of-the-art open- and closed-source models, and 851 real bugs on two Java benchmarks (i.e., 605 bugs from 12 projects of Defects4J 2.0 and 246 bugs of ConDefects). We find that compared to existing approaches, LLMs generate more diverse mutations that are behaviorally closer to real bugs, which leads to approximately 19% higher fault detection than current approaches (i.e., 93% vs. 74%). Nevertheless, the mutants generated by LLMs have worse compilability rate, useless mutation rate, and equivalent mutation rate than those generated by rule-based approaches. This paper also examines alternative prompt engineering strategies and identifies the root causes of uncompilable mutations, providing insights for researchers to further enhance the performance of LLMs in mutation testing.<|reference_end|>
@article{wang2024an,
    title={An Exploratory Study on Using Large Language Models for Mutation Testing},
    author={Bo Wang, Mingda Chen, Youfang Lin, Mike Papadakis and Jie M. Zhang},
    journal={arXiv preprint arXiv:2406.09843},
    year={2024},
    archivePrefix={arXiv},
    eprint={2406.09843},
    primaryClass={cs.SE}
}