[论文解读] Tailored Mutants Fit Bugs Better
本文提出定制化的变异操作符,通过重用目标项目代码库及其版本历史中的标识符和字面量生成变异体,显著提高了与真实缺陷的耦合度——比传统操作符高出14%,同时通过子模优化进行位置选择、基于自然度的排序进行变异体过滤,解决了由此引发的可扩展性问题。
Mutation analysis measures test suite adequacy, the degree to which a test suite detects seeded faults: one test suite is better than another if it detects more mutants. Mutation analysis effectiveness rests on the assumption that mutants are coupled with real faults i.e. mutant detection is strongly correlated with real fault detection. The work that validated this also showed that a large portion of defects remain out of reach. We introduce tailored mutation operators to reach and capture these defects. Tailored mutation operators are built from and apply to an existing codebase and its history. They can, for instance, identify and replay errors specific to the project for which they are tailored. As our point of departure, we define tailored mutation operators for identifiers, which mutation analysis has largely ignored, because there are too many ways to mutate them. Evaluated on the Defects4J dataset, our new mutation operators creates mutants coupled to 14% more faults, compared to traditional mutation operators. These new mutation operators, however, quadruple the number of mutants. To combat this problem, we propose a new approach to mutant selection focusing on the location at which to apply mutation operators and the unnaturalness of the mutated code. The results demonstrate that the location selection heuristics produce mutants more closely coupled to real faults for a given budget of mutation operator applications. In summary, this paper defines and explores tailored mutation operators, advancing the state of the art in mutation testing in two ways: 1) it suggests mutation operators that mutate identifiers and literals, extending mutation analysis to a new class of faults and 2) it demonstrates that selecting the location where a mutation operator is applied decreases the number of generated mutants without affecting the coupling of mutants and real faults.
研究动机与目标
- 解决传统变异操作符在先前的实证研究中未能与27%的真实缺陷耦合的局限性。
- 克服使用传统操作符时因变异体数量呈指数级增长而引发的变异测试可扩展性问题。
- 通过为代码库及其历史量身定制的变异操作符,提升变异分析的有效性,从而增加检测真实缺陷的可能性。
- 开发一种新的变异体选择策略,在不牺牲与真实缺陷耦合度的前提下,减少生成的变异体数量,重点聚焦于位置选择和不自然度。
- 证明定制化变异操作符能够显著提升变异体检测与真实缺陷检测之间的相关性,推动变异测试领域的研究进展。
提出的方法
- 设计定制化的变异操作符,将标识符和字面量替换为从项目代码库和版本历史中提取的语义有效替代项,确保类型安全和作用域正确性。
- 应用子模优化选择程序位置进行变异,使其在控制流图中尽可能相互远离,以实现变异体覆盖的多样化并减少冗余。
- 基于n-gram语言模型对单个变异体进行自然度排序,优先选择与典型代码模式偏离最大的变异体——依据的洞察是:有缺陷的代码往往更不自然。
- 结合位置选择与自然度排序,减少执行的变异体数量,同时保持或提升故障检测的有效性。
- 在Defects4J基准套件上评估该方法,比较定制化操作符与传统操作符在变异体数量、故障耦合度和选择效率方面的表现。
- 采用混合变异体选择策略:首先通过子模优化选择多样化的程序位置,然后在这些位置内根据自然度得分过滤变异体。
实验结果
研究问题
- RQ1与传统变异操作符相比,重用项目代码库和版本历史中标识符与字面量的定制化变异操作符是否能提高变异体与真实缺陷的耦合度?
- RQ2定制化变异操作符在检测真实缺陷方面的有效性提升程度如何,具体表现为额外检测到的缺陷数量?
- RQ3当定制化操作符生成的变异体数量远超传统操作符时,如何缓解变异测试的可扩展性问题?
- RQ4与随机或均匀选择相比,使用子模优化选择变异位置是否能带来更有效的变异体选择策略?
- RQ5基于自然度的变异体排序能否通过聚焦于最可能与真实缺陷耦合的变异体,提升变异体选择的效率?
主要发现
- 在Defects4J基准测试中,与传统操作符相比,定制化变异操作符使与缺陷耦合的变异体数量提高了14%。
- 新设计的变异操作符平均生成的变异体数量是当前最先进的传统操作符的四倍,加剧了可扩展性问题。
- 用于位置选择的子模优化减少了变异体冗余,提升了故障检测效率,使在给定预算下生成的变异体与真实缺陷的耦合度更高。
- 基于自然度的变异体排序——即优先选择n-gram语言模型中熵值较低的变异体——被证明能有效过滤掉不相关的变异体,同时不损害故障检测能力。
- 子模位置选择与基于自然度的过滤相结合,实现了比随机选择更少的变异体数量下更高的故障检测率,证明了效率的提升。
- 结果证实,定制化变异操作符能够有效针对此前未被覆盖的缺陷,特别是那些涉及标识符和字面量误用的缺陷,而传统操作符往往难以发现。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。