Search-based test case implantation for testing untested configurations
The significant rise in the complexity and configurations of software systems potentially requires a large number of test cases to test configurations of the systems. To deal with this challenge, we present a novel automated approach (termed as SBI) to implant existing test cases of software systems with the functionality to cover untested configurations of the software system; thus significantly reducing the effort to write new test cases to test the untested configurations. Our automated approach consists of two keys steps implemented into software components termed as Test Case Analyzer and Test Case Implanter. Test Case Analyzer automatically analyzes the code of test cases and generates a program dependence graph required by the second component. Test Case Implanter is implemented with a multi-objective search approach that searches for the most suitable test cases for implantation using search operators (i.e., selection, crossover, and mutation operators) followed by implanting the selected test cases by applying mutation operations focusing on adding, modifying, or deleting the test case source code. To guide the search, we defined various objectives: number of configuration variable values covered, pairwise coverage of parameter values of test API commands, number of implanted test cases, number of changed statements, and estimated execution time.
To assess the cost-effectiveness of our approach, we applied it to one industrial case study of video conferencing system and one open source case study. We experimented our approach (i.e., SBI) with three search algorithms: Non-dominated Sorting Genetic Algorithm II (NSGA-II), weight-based genetic algorithm (WGA), and random search (RS). In general, we found that the implanted test cases with SBI using the three algorithms had significantly higher configuration coverage than the original test cases for both case studies. When comparing the three algorithms with our approach, we found that NSGA-II performed the best. Specifically, SBI with NSGA-II managed to achieve, on average 19.3% higher number of configuration variable values and 57.0% higher pairwise coverage of parameter values of test API commands.