一句话:基于近1500万变异体,实证表明变异测试促使开发者补充高质量测试,并与真实故障相关。
变异测试被视为代码覆盖率的替代指标,但缺少证据表明为变异体编写测试能提升测试质量。本文分析近1500万个变异体数据,考察变异体随时间对开发者行为的影响,并关联历史高优先级真实故障修复。结果显示,使用变异测试的开发者会编写更多测试,并主动用高质量测试改进测试套件,使存活变异体减少;同时,变异体与真实故障存在耦合,若在引入故障的变更上使用变异测试,本可报告存活的变异体并预防该缺陷。
Various proxy metrics for test quality have been defined in order to guide developers when writing tests. Code coverage is particularly well established in practice, even though the question of how coverage relates to test quality is a matter of ongoing debate. Mutation testing offers a promising alternative: Artificial defects can identify holes in a test suite, and thus provide concrete suggestions for additional tests. Despite the obvious advantages of mutation testing, it is not yet well established in practice. Until recently, mutation testing tools and techniques simply did not scale to complex systems. Although they now do scale, a remaining obstacle is lack of evidence that writing tests for mutants actually improves test quality. In this paper we aim to fill this gap: By analyzing a large dataset of almost 15 million mutants, we investigate how these mutants influenced developers over time, and how these mutants relate to real faults. Our analyses suggest that developers using mutation testing write more tests, and actively improve their test suites with high quality tests such that fewer mutants remain. By analyzing a dataset of past fixes of real high-priority faults, our analyses further provide evidence that mutants are indeed coupled with real faults. In other words, had mutation testing been used for the changes introducing the faults, it would have reported a live mutant that could have prevented the bug.