一种结合数据流约束的变异测试用例生成方法
A Method Combined with Data Flow Constraint for Generating Mutation Test Cases
DOI: 10.12677/SEA.2018.72012, PDF,  被引量    国家自然科学基金支持
作者: 杜小智*, 强倩瑶, 黄琳婷:西安交通大学软件学院,陕西 西安
关键词: 变异测试测试用例生成适应度函数变异评分Mutation Testing Test Case Generation Fitness Function Mutation Score
摘要: 变异测试是一种高效的软件测试方法。作为发现故障和发现测试用例缺陷的一种手段,测试用例生成方法至关重要。如果测试用例能有效地生成并获得较高的变异评分,则有助于变异测试的广泛应用。目前大部分变异测试用例生成方法都是通过分析控制流图,仅使用语句间的控制流约束指导用例的生成,而未考虑语句间数据流约束的影响。本文提出一种结合数据流约束的变异测试用例生成方法,首先,将控制流约束和数据流约束二者结合对适应度函数进行建模;其次,将该模型应用于遗传算法指导测试用例的进化和选择。实验表明,与HGA相比,本方法在生成同样规模的测试集时平均迭代次数减少了60.5%;并且生成的测试用例获得的变异评分比随机方法平均高出了27.9%,表现出了更优的错误检测能力。
Abstract: 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.
文章引用:杜小智, 强倩瑶, 黄琳婷. 一种结合数据流约束的变异测试用例生成方法[J]. 软件工程与应用, 2018, 7(2): 99-109. https://doi.org/10.12677/SEA.2018.72012

参考文献

[1] Demillo, R.A., Lipton, R.J. and Sayward, F.G. (1978) Hints on Test Data Selection: Help for the Practicing Programmer. Computer, 11, 34-41.
[Google Scholar] [CrossRef
[2] 单锦辉, 高友峰, 刘明浩, 等. 一种新的变异测试数据自动生成方法[J]. 计算机学报, 2008, 31(6): 1025-1034.
[3] Fraser, G. and Zeller, A. (2012) Mutation-Driven Generation of Unit Tests and Oracles. IEEE Transactions on Software Engineering, 38, 278-292.
[Google Scholar] [CrossRef
[4] Fraser, G. and Arcuri, A. (2014) Achieving Scalable Mutation-Based Generation of Whole Test Suites. Empirical Software Engineering, 20, 783-812.
[Google Scholar] [CrossRef
[5] Delamaro, M.E., Maldonado, J.C. and Mathur, A.P. (2001)\ Interface Mutation: An Approach for Integration Testing. IEEE Transactions on Software Engineering, 27, 228-247.
[Google Scholar] [CrossRef
[6] Delgado-Pérez, P., Segura, S. and Medina-Bulo, I. (2017) Assessment of C++ Ob-ject-Oriented Mutation Operators: A Selective Mutation Approach. Software Testing Verification & Reliability, e1630.
[Google Scholar] [CrossRef
[7] Bhatia, V. and Singhal, A. (2016) Class/Aspect Level Mutation Operators in As-pect-Oriented Software Systems. 2016 1st India International Conference on Information Processing (IICIP), Delhi, 12-14 August 2016, 1-7.
[Google Scholar] [CrossRef
[8] 刘新忠, 徐高潮, 胡亮, 等. 一种基于约束的变异测试数据生成方法[J]. 计算机研究与发展, 2011, 48(4): 617-626.
[9] DeMillo, R.A. and Offutt, A.J. (1991) Constraint-Based Automatic Test Data Gen-eration. IEEE Transactions on Software Engineering, 17, 900-910.
[Google Scholar] [CrossRef
[10] Offutt, A.J., Jin, Z. and Pan, J. (1999) The Dynamic Domain Reduction Procedure for Test Data Generation. Software: Practice and Experience, 29, 167-193.
[Google Scholar] [CrossRef
[11] 赵性颂, 顾斌. 遗传算法生成变异测试用例[J]. 计算机应用, 2009, 29( 6): 262-264.
[12] Souza, F.C.M., Papadakis, M. and Traon, Y.L. (2016) Strong Muta-tion-Based Test Data Generation Using Hill Climbing. International Workshop on Search-Based Software Testing. ACM, Austin, 14-22 May 2016, 45-54.
[Google Scholar] [CrossRef
[13] Offutt, A.J. and Pan, J. (2015) Automatically Detecting Equivalent Mutants and Infeasible Paths. Software Testing Verification & Reliability, 7, 165-192.
[Google Scholar] [CrossRef
[14] Khan, R., Amjad, M. and Sri-vastava, A.K. (2017) Generation of Automatic Test Cases with Mutation Analysis and Hybrid Genetic Algorithm. 2017 3rd Interna-tional Conference on Computational Intelligence & Communication Technology (CICT), Ghaziabad, 9-10 February 2017, 1-4.
[Google Scholar] [CrossRef