摘要
变异测试是一种高效的软件测试方法。作为发现故障和发现测试用例缺陷的一种手段,测试用例生成方法至关重要。如果测试用例能有效地生成并获得较高的变异评分,则有助于变异测试的广泛应用。目前大部分变异测试用例生成方法都是通过分析控制流图,仅使用语句间的控制流约束指导用例的生成,而未考虑语句间数据流约束的影响。本文提出一种结合数据流约束的变异测试用例生成方法,首先,将控制流约束和数据流约束二者结合对适应度函数进行建模;其次,将该模型应用于遗传算法指导测试用例的进化和选择。实验表明,与HGA相比,本方法在生成同样规模的测试集时平均迭代次数减少了60.5%;并且生成的测试用例获得的变异评分比随机方法平均高出了27.9%,表现出了更优的错误检测能力。
Mutation testing is a powerful method of software testing. As a means of finding faults and unco-vering test suite defects, the method of test case generation is crucially important. If the test case can generate efficiently and achieve a higher mutation score, it has the potential to help mutation testing be widely adopted. At present, most of the mutation test case generation methods are based on the analysis of the control flow graph, using only the control flow constraint between the statements to guide the generation of test cases, without considering the influence of the data flow constraint among the statements. In this paper, a mutation test case generation method combined with data flow constraint is proposed. First, the control flow constraint and the data flow constraint were combined to model the fitness function;second, the model was used in genetic algorithms to guide the selection and evolution of the test cases. Experiments show that the average iteration number is reduced by 60.53% when generating the same scale test set compared to HGA, and the generated test cases get a 27.9% higher mutation score than random method, showing a better error detection ability.
出处
《软件工程与应用》
2018年第2期99-109,共11页
Software Engineering and Applications
基金
国家自然科学基金资助项目(11575138)
陕西省工业公关项目资助项目(2013K06-20)
中央高校基本科研业务费专项基金资助项目(XJJ2015122)
轨道交通工程信息化国家重点实验室开放课题项目(SKLK16-08)。