Learning How to Search: Generating Effective Test Cases Through Adaptive Fitness Function Selection
Preprint
Abstract
Search-based test generation is guided by feedback from one or more fitness functions -- scoring functions that judge solution optimality. Choosing informative fitness functions is crucial to meeting the goals of a tester. Unfortunately, many goals - such as forcing the class-under-test to throw exceptions, increasing test suite diversity, and attaining Strong Mutation Coverage - do not have effective fitness function formulations. We propose that meeting such goals requires treating fitness function identification as a secondary optimization step. An adaptive algorithm that can vary the selection of fitness functions could adjust its selection throughout the generation process to maximize goal attainment, based on the current population of test suites. To test this hypothesis, we have implemented two reinforcement learning algorithms in the EvoSuite unit test generation framework, and used these algorithms to dynamically set the fitness functions used during generation for the three goals identified above. We have evaluated our framework, EvoSuiteFIT, on a set of Java case examples. EvoSuiteFIT techniques attain significant improvements for two of the three goals, and show limited improvements on the third when the number of generations of evolution is fixed. Additionally, for two of the three goals, EvoSuiteFIT detects faults missed by the other techniques. The ability to adjust fitness functions allows strategic choices that efficiently produce more effective test suites, and examining these choices offers insight into how to attain our testing goals. We find that adaptive fitness function selection is a powerful technique to apply when an effective fitness function does not already exist for achieving a testing goal.Keywords
All Related Versions
This publication has 53 references indexed in Scilit:
- An evaluation of Monte Carlo-based hyper-heuristic for interaction testing of industrial embedded software applicationsSoft Computing, 2020
- Choosing the fitness function for the job: Automated generation of test suites that detect real faultsSoftware Testing, Verification and Reliability, 2019
- A Classification of Hyper-Heuristic Approaches: Revisited2018
- A Tutorial on Using and Extending the EvoSuite Search-Based Test Generator2018
- A Hyper-heuristic for Multi-objective Integration and Test Ordering in Google Guava2017
- A detailed investigation of the effectiveness of whole test suite generationEmpirical Software Engineering, 2016
- Combining Multiple Coverage Criteria in Search-Based Unit Test Generation2015
- Achieving scalable mutation-based generation of whole test suitesEmpirical Software Engineering, 2014
- It really does matter how you normalize the branch distance in search‐based software testingSoftware Testing, Verification and Reliability, 2011
- Search‐based software test data generation: a surveySoftware Testing, Verification and Reliability, 2004