Abstract

SummaryAn 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.

Highlights

  • Generating software test cases is an important task, with the objective of improving software quality

  • We present an implementation of Chemical Reaction Optimization (CRO) for test generation within EVOSUITE, and further include EVOSUITE’s archive of solutions in our experiment, which allows the evolutionary search to focus on uncovered code, resembling more how random search optimizes for coverage

  • We presented an empirical study comparing the effectiveness of evolutionary and random search-based algorithms for generating test suites aimed at maximising branch coverage

Read more

Summary

Introduction

Generating software test cases is an important task, with the objective of improving software quality. One particular application area in which search-based techniques have been successfully applied is generating unit tests for objectoriented programs, where test cases are sequences of object constructor and method calls. RANDOM OR EA SEARCH FOR OBJECT-ORIENTED TEST SUITE GENERATION?. Generated tests can be used to reveal crashes and undeclared exceptions (e.g., Csallner and Smaragdakis [1], Pacheco and Ernst [2]), to capture the current behavior for regression testing (e.g., Fraser and Zeller [3], Xie [4]), or they can be presented to the developer in order to support them in creating test suites [5]. There are various searchbased tools available for languages such as Java and .NET, ranging from tools based on random search such as Randoop [2], JCrasher [1], JTExpert [6], T3 [7], or Yeti-Test [8], to tools based on evolutionary search such as EVOSUITE [9], eToc [10], NightHawk [11], or Testful [12]

Objectives
Methods
Results
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call