Abstract
The aim of software testing is to find faults in a program under test, so generating test data that can expose the faults of a program is very important. To date, current studies on generating test data for path coverage do not perform well in detecting low probability faults on the covered path. The automatic generation of test data for both path coverage and fault detection using genetic algorithms is the focus of this study. To this end, the problem is first formulated as a bi-objective optimization problem with one constraint whose objectives are the number of faults detected in the traversed path and the risk level of these faults, and whose constraint is that the traversed path must be the target path. An evolutionary algorithmis employed to solve the formulatedmodel, and several types of fault detectionmethods are given. Finally, the proposed method is applied to several real-world programs, and compared with a random method and evolutionary optimization method in the following three aspects: the number of generations and the time consumption needed to generate desired test data, and the success rate of detecting faults. The experimental results confirm that the proposed method can effectively generate test data that not only traverse the target path but also detect faults lying in it.
Similar content being viewed by others
References
Myers G. The art of software testing. New York: Wiley, 1979
Beizer B. Software testing techniques. New York: Van Nostrand Rheinhold, 1990
Tassey G. The economic impacts of inadequate infrastructure for software testing. Gaithersburg: National Institute of Standards and Technology, 2002
Gross H, Kruse P M, Wegener J. Evolutionary white-box software test with the evotest framework, a progress report. In: Proceedings of IEEE International Conference on Software Testing Verification and Validation Workshops, ICST’ 09. 2009, 111–120
Korel B. Automated software test data generation. IEEE Transactions on Software Engineering, 1990, 16(8): 870–879
Sofokleous A A, Andreou A S. Automatic, evolutionary test data generation for dynamic software testing. The Journal of Systems and Software, 2008, 81(11): 1883–1898
Gong D W, Zhang Y. Novel evolutionary generation approach of test data for multiple paths. Acta Electronica Sinica, 2010, 38(6): 1299–1304
Gong D W, Zhang W Q, Yao X J. Evolutionary generation of test data for many paths coverage based on grouping. The Journal of Systems and Software, 2011, 84(12): 2222–2233
Gong D W, Tian T, Yao X J. Grouping target paths for evolutionary generation of test data in parallel. The Journal of Systems and Software, 2012, 85(11): 2531–2540
Zhang Y, Gong DW. Evolutionary genetation of test data for path coverage based on automatic reduction of searchspace. Acta Electronica Sinica, 2012, 40(5): 1011–1016
Caserta M, Uribe A M. Tabu search-based metaheuristic algorithm for software system reliability problems. Computers & Operations Research, 2009, 36(3): 811–822
Windisch A, Wappler S, Wegener J. Applying particle swarm optimization to software testing. In: Proceedings of Genetic and Evolutionary Computation Conference, GECCO’ 07. 2007, 1121–1128
Sagarna R, Yao X. Handling constraints for search based software test data generation. In: Proceedings of IEEE International Conference on Software Testing Verification and Validation Workshop, ICST’ 08. 2008, 232–240
Ghiduk A S, Harrold MJ. Using genetic algorithms to aid test data generation for data flow coverage. In: Proceedings of the 14th Asia-Pacific Software Engineering Conference, APSEC’ 07. 2007, 41–48
Harman M, Lakhotia K, McMinn P. A multi-objective approach to search-based test data generation. In: Proceedings of Genetic and Evolutionary Computation Conference, GECCO’ 07. 2007, 1098–1105
Gong D W, Zhang Y. Generating test data for both paths coverage and faults detection using genetic algorithms. In: Proceedings of International Conference on Intelligent Computing, ICIC’ 11. 2011, 664–671
Shan J H, Wang J, Qi Z C. Survey on path-wise automatic generation of test data. Acta Electronica Sinica, 2004, 32(1): 109–113
Chen T Y, Kuo F C, Merkel R G. Adaptive random testing: the art of test case diversity. The Journal of Systems and Software, 2010, 83(1): 60–66
Ding Z, Zhang K, Hua J. A rigorous approach towards test case generation. Information Sciences, 2008, 178(21): 4057–4079
Holland J H. Adaptation in natural and artificial systems. Michigan: The University of Michigan, 1975
Xanthakis S, Ellis C, Skourlas C. Application of genetic algorithms to software testing. In: Proceedings of the 5th International Conference on Software Engineering, ICSE’ 92. 1992, 625–636
McMinn P. Search-based software test data generation: a survey. Software Testing, Verification and Reliability, 2004, 14(2): 105–156
Pachauri A, Srivastava G. Automated test data generation for branch testing using genetic algorithm: an improved approach using branch ordering, memory and elitism. The Journal of Systems and Software, 2013, 86(5): 1191–1208
Xiao M, Mohamed E A, Reformat M. Empirical evaluation of optimization algorithms when used in goal-oriented automated test data generation techniques. Empirical Software Engineering, 2007, 12(2): 183–239
Arcuri A, Yao X. Search based software testing of object-oriented containers. Information Sciences, 2008, 178(15): 3075–3095
Buhler O, Wegener J. Evolutionary functional testing. Computers & Operations Research, 2008, 35(10): 3144–3160
Yoo S, Harman M. Areto efficient multi-objective test case selection. In: Proceedings of International Symposium on Software Testing and Analysis, ISSTA’ 07. 2007, 140–150
Yang Z H, Gong Y Z, Xiao Q, Wang Y W. A defect model based testing system. Journal of Beijing University of Posts and Telecommunications, 2008, 31(5): 1–4
Ahmed M A, Hermadi I. GA-based multiple paths test data generator. Computer & Operations Research, 2008, 35(10): 3107–3124
Gong Y Z, Zhao R L, Zhang W, Zhao H Q. Software testing. Beijing: China Machine Press, 2008
Deb K. Multi-objective optimization using evolutionary algorithms. American: John Wiley & Sons Inc., 2009
Xuan G N, Cheng R W. Genetic algorithms and engineering optimization. Beijing: Tsinghua University Press, 2004
Jia Y, Harman M. An analysis and survey of the development of mutation testing. IEEE Transactions on Software Engineering, 2011, 37(5): 649–678
Hyunsook D, Sebastian E, Gregg R. Supporting controlled experimentation with testing techniques: an infrastructure and its potential impact. Empirical Software Engineering: An International Journal, 2005, 10(4): 405–435
Zhong H, Zhang L, Mei H. An experimental study of four typical test suite reduction techniques. Information and Software Technology, 2008, 50(6): 534–546
Hutchins M, Foster H, Goradia T. Experiments of the effectiveness of data flow and control flow-based test adequacy criteria. In: Proceedings of 16th International Conference on Software Engineering, ICSE’ 94. 1994, 191–200
Author information
Authors and Affiliations
Corresponding author
Additional information
Dunwei Gong received PhD in control theory and control engineering from China University of Mining and Technology, Xuzhou, China, in 1999. Since 2004, he has been a professor and is now director of the Institute of Automation, China University of Mining and Technology. His research interest is search-based software engineering.
Yan Zhang received MS in education from Liaoning Normal University, Dalian, China, in 2000. Since 2008, she has been a PhD candidate in control theory and control engineering at China University of Mining and Technology, Xuzhou, China. Her main research interest is generation of test data of complex software.
Rights and permissions
About this article
Cite this article
Gong, D., Zhang, Y. Generating test data for both path coverage and fault detection using genetic algorithms. Front. Comput. Sci. 7, 822–837 (2013). https://doi.org/10.1007/s11704-013-3024-3
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11704-013-3024-3