针对变异测试代价大、无法广泛应用的问题,提出了一种在变异测试过程中引进测试用例选择以降低测试代价的方法.通过为每个变异体选择一定数量的测试用例,约束变异体允许执行的最大次数,从而减少无用功.测试用例的选择与变异体的变异程度相关,变异距离是描述源程序和变异体之间差异程度的指标,能够衡量测试集中有效测试用例的比例,进而指导测试用例的选择.距离越大,意味着变异体越容易被杀死,对应的有效测试用例则越多.实验结果表明该方法在不影响测试效果的情况下,可以明显降低变异测试的执行成本.
Aimed at the problem of expensive costs in mutation testing which has hampered its wide use,a technique of introducing a test case selection into the process of mutation testing is proposed.For each mutant,a fixed number of test cases are selected to constrain the maximum allowable executions so as to reduce useless work.Test case selection largely depends on the degree of mutation.The mutation distance is an index describing the semantic difference between the original program and the mutated program.It represents the percentage of effective test cases in a test set,so it can be used to guide the selection of test cases.The bigger the mutation distance is,the easier it is that the mutant will be killed,so the corresponding number of effective test cases for this mutant is greater.Experimental results suggest that the technique can remarkably reduce execution costs without a significant loss of test effectiveness.