Beijing Jiaotong University(北京交通大学);Beijing Key Laboratory of Traffic Data Mining and Embodied Intelligence(北京市交通数据挖掘与具身智能重点实验室);Singapore Management University(新加坡管理大学);University College London(伦敦大学学院);University of Luxembourg(卢森堡大学);King’s College London(伦敦国王学院)
Bo Wang, Ming Deng, Mingda Chen, Chengran Yang, Youfang Lin, Mark Harman, Mike Papadakis, Jie M. Zhang
LLM-based mutation testing is a promising testing technology, but existing approaches typically rely on a fixed set of mutations as few-shot examples or none at all. This can result in generic low-quality mutations, missed context-specific mutation patterns, substantial numbers of redundant and uncompilable mutants, and limited semantic similarity to real bugs. To overcome these limitations, we introduce SMART (Semantic Mutation with Adaptive Retrieval and Tuning). SMART integrates retrieval-augmented generation (RAG) on a vectorized dataset of real-world bugs, focused code chunking, and supervised fine-tuning using mutations coupled with real-world bugs. We conducted an extensive empirical study of SMART using 1,991 real-world Java bugs from the Defects4J and ConDefects datasets, comparing SMART to the state-of-the-art LLM-based approaches, LLMut and LLMorpheus. The results reveal that SMART substantially improves mutation validity, effectiveness, and efficiency (even enabling small-scale 7B-scale models to match or even surpass large models like GPT-4o). We also demonstrate that SMART significantly improves downstream software engineering applications, including test case prioritization and fault localization. More specifically, SMART improves validity (weighted average generation rate) from 42.89% to 65.6%. It raises the non-duplicate rate from 87.38% to 95.62%, and the compilable rate from 88.85% to 90.21%. In terms of effectiveness, it achieves a real bug detection rate of 92.61% (vs. 57.86% for LLMut) and improves the average Ochiai coefficient from 25.61% to 38.44%. For fault localization, SMART ranks 64 more bugs as Top-1 under MUSE and 57 more under Metallaxis.
Mutation-Guided Unit Test Generation with a Large Language Model
University of Limerick(利默里克大学);Research Ireland Lero Centre for Software, University of Limerick(爱尔兰研究莱罗软件中心,利默里克大学);University of Ottawa(渥太华大学);Software Engineering Application Technology Lab Huawei(华为软件工程应用技术实验室)
SWE-Mutation: Can LLMs Generate Reliable Test Suites in Software Engineering?
State Key Laboratory of Cognitive Intelligence(认知智能国家重点实验室);University of Science and Technology of China(中国科学技术大学);Beihang University(北航);School of Mathematical Sciences, Peking University(北京大学数学科学学院);NeoShell AI;Institute of Artificial Intelligence, Hefei Comprehensive National Science Center(合肥综合性国家科学中心人工智能研究院)