Random or evolutionary search for object‐oriented test suite generation?

An important aim in software testing is constructing a test suite with high structural code coverage, that is, ensuring that most if not all of the code under test have been executed by the test cases comprising the test suite. Several search‐based techniques have proved successful at automatically generating tests that achieve high coverage. However, despite the well‐established arguments behind using evolutionary search algorithms (eg, genetic algorithms) in preference to random search, it remains an open question whether the benefits can actually be observed in practice when generating unit test suites for object‐oriented classes. In this paper, we report an empirical study on the effects of using evolutionary algorithms (including a genetic algorithm and chemical reaction optimization) to generate test suites, compared with generating test suites incrementally with random search. We apply the EVOSUITE unit test suite generator to 1000 classes randomly selected from the SF110 corpus of open‐source projects. Surprisingly, the results show that the difference is much smaller than one might expect: While evolutionary search covers more branches of the type where standard fitness functions provide guidance, we observed that, in practice, the vast majority of branches do not provide any guidance to the search. These results suggest that, although evolutionary algorithms are more effective at covering complex branches, a random search may suffice to achieve high coverage of most object‐oriented classes.

[1]  Gordon Fraser,et al.  Seeding strategies in search‐based unit test generation , 2016, Softw. Test. Verification Reliab..

[2]  Gordon Fraser,et al.  Improving search-based test suite generation with dynamic symbolic execution , 2013, 2013 IEEE 24th International Symposium on Software Reliability Engineering (ISSRE).

[3]  Manuel López-Ibáñez,et al.  Ant colony optimization , 2010, GECCO '10.

[4]  Mark Harman,et al.  Automated web application testing using search based software engineering , 2011, 2011 26th IEEE/ACM International Conference on Automated Software Engineering (ASE 2011).

[5]  Manuel Oriol,et al.  Testing .NET Code with YETI , 2010, 2010 15th IEEE International Conference on Engineering of Complex Computer Systems.

[6]  Jin Xu,et al.  On the Convergence of Chemical Reaction Optimization for Combinatorial Optimization , 2013, IEEE Transactions on Evolutionary Computation.

[7]  Gordon Fraser,et al.  A detailed investigation of the effectiveness of whole test suite generation , 2017, Empirical Software Engineering.

[8]  Thomas Bäck,et al.  A Survey of Evolution Strategies , 1991, ICGA.

[9]  Mark Harman,et al.  Testability transformation , 2004, IEEE Transactions on Software Engineering.

[10]  Victor O. K. Li,et al.  Real-Coded Chemical Reaction Optimization , 2012, IEEE Transactions on Evolutionary Computation.

[11]  Mark Harman,et al.  A Theoretical and Empirical Study of Search-Based Testing: Local, Global, and Hybrid Search , 2010, IEEE Transactions on Software Engineering.

[12]  Gordon Fraser,et al.  The Seed is Strong: Seeding Strategies in Search-Based Software Testing , 2012, 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation.

[13]  Tim Menzies,et al.  Nighthawk: a two-level genetic-random unit test data generator , 2007, ASE.

[14]  Phil McMinn,et al.  Search-Based Test Input Generation for String Data Types Using the Results of Web Queries , 2012, 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation.

[15]  Gordon Fraser,et al.  Random or Genetic Algorithm Search for Object-Oriented Test Suite Generation? , 2015, GECCO.

[16]  Gordon Fraser,et al.  Does Automated Unit Test Generation Really Help Software Testers? A Controlled Empirical Study , 2015, ACM Trans. Softw. Eng. Methodol..

[17]  Jin Xu,et al.  Stock Portfolio Selection Using Chemical Reaction Optimization , 2011 .

[18]  Victor O. K. Li,et al.  Evolutionary artificial neural network based on Chemical Reaction Optimization , 2011, 2011 IEEE Congress of Evolutionary Computation (CEC).

[19]  A. Vargha,et al.  A Critique and Improvement of the CL Common Language Effect Size Statistics of McGraw and Wong , 2000 .

[20]  Mark Harman,et al.  Improving Evolutionary Testing By Flag Removal , 2002, GECCO.

[21]  Bogdan Korel,et al.  Automated Software Test Data Generation , 1990, IEEE Trans. Software Eng..

[22]  Tanja E. J. Vos,et al.  Unit testing tool competition: round four , 2016, SBST@ICSE.

[23]  Victor O. K. Li,et al.  Chemical-Reaction-Inspired Metaheuristic for Optimization , 2010, IEEE Transactions on Evolutionary Computation.

[24]  Gordon Fraser,et al.  Parameter tuning or default values? An empirical investigation in search-based software engineering , 2013, Empirical Software Engineering.

[25]  Yannis Smaragdakis,et al.  JCrasher: an automatic robustness tester for Java , 2004, Softw. Pract. Exp..

[26]  Yann-Gaël Guéhéneuc,et al.  Instance Generator and Problem Representation to Improve Object Oriented Code Coverage , 2015, IEEE Transactions on Software Engineering.

[27]  Lars Grunske,et al.  Analysing the fitness landscape of search-based software testing problems , 2017, Automated Software Engineering.

[28]  Gordon Fraser,et al.  Testing Container Classes: Random or Systematic? , 2011, FASE.

[29]  Andreas Zeller,et al.  Mutation-Driven Generation of Unit Tests and Oracles , 2012, IEEE Trans. Software Eng..

[30]  Victor O. K. Li,et al.  Chemical Reaction Optimization for population transition in peer-to-peer live streaming , 2010, IEEE Congress on Evolutionary Computation.

[31]  Phil McMinn,et al.  Search‐based software test data generation: a survey , 2004, Softw. Test. Verification Reliab..

[32]  Riccardo Poli,et al.  Particle swarm optimization , 1995, Swarm Intelligence.

[33]  Gordon Fraser,et al.  Do Automatically Generated Unit Tests Find Real Faults? An Empirical Study of Effectiveness and Challenges (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[34]  Tao Xie,et al.  Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking , 2006, ECOOP.

[35]  André Baresel,et al.  Evolutionary Testing of Flag Conditions , 2003, GECCO.

[36]  Joachim Wegener,et al.  Evolutionary test environment for automatic structural testing , 2001, Inf. Softw. Technol..

[37]  David H. Wolpert,et al.  No free lunch theorems for optimization , 1997, IEEE Trans. Evol. Comput..

[38]  Gordon Fraser,et al.  Whole Test Suite Generation , 2013, IEEE Transactions on Software Engineering.

[39]  Gordon Fraser,et al.  EvoSuite: automatic test suite generation for object-oriented software , 2011, ESEC/FSE '11.

[40]  Jin Xu,et al.  Chemical Reaction Optimization for Task Scheduling in Grid Computing , 2011, IEEE Transactions on Parallel and Distributed Systems.

[41]  Gordon Fraser,et al.  A Memetic Algorithm for whole test suite generation , 2015, J. Syst. Softw..

[42]  Vinicius H. S. Durelli,et al.  Quantifying the Characteristics of Java Programs That May Influence Symbolic Execution from a Test Data Generation Perspective , 2014, 2014 IEEE 38th Annual Computer Software and Applications Conference.

[43]  GORDON FRASER,et al.  A Large-Scale Evaluation of Automated Unit Test Generation Using EvoSuite , 2014, ACM Trans. Softw. Eng. Methodol..

[44]  Tung Khac Truong,et al.  Chemical reaction optimization with greedy strategy for the 0-1 knapsack problem , 2013, Appl. Soft Comput..

[45]  Victor O. K. Li,et al.  Chemical Reaction Optimization: a tutorial , 2012, Memetic Computing.

[46]  Michael D. Ernst,et al.  Randoop: feedback-directed random testing for Java , 2007, OOPSLA '07.

[47]  Gordon Fraser,et al.  Bytecode Testability Transformation , 2011, SSBSE.

[48]  I. S. Wishnu T3, a Combinator-Based Random Testing Tool for Java: Benchmarking , 2014 .

[49]  Gordon Fraser,et al.  Handling test length bloat , 2013, Softw. Test. Verification Reliab..

[50]  Thomas Stützle,et al.  Ant colony optimization: artificial ants as a computational intelligence technique , 2006 .

[51]  Luciano Baresi,et al.  TestFul: An Evolutionary Test Approach for Java , 2010, 2010 Third International Conference on Software Testing, Verification and Validation.

[52]  Paolo Tonella,et al.  Evolutionary testing of classes , 2004, ISSTA '04.

[53]  Dervis Karaboga,et al.  A powerful and efficient algorithm for numerical function optimization: artificial bee colony (ABC) algorithm , 2007, J. Glob. Optim..

[54]  Lionel C. Briand,et al.  A Systematic Review of the Application and Empirical Investigation of Search-Based Test Case Generation , 2010, IEEE Transactions on Software Engineering.