Searching and generating test inputs for mutation testing

Mike Papadakis, Nicos MalevrisSpringerPlus 2013

Abstract

Mutation testing is usually regarded as an important method towards fault revealing. Despite this advantage, it has proved to be impractical for industrial use because of its expenses. To this extend, automated techniques are needed in order to apply and reduce the method's demands. Whilst there is much evidence that automated test data generation techniques can effectively automate the testing process, there has been little work on applying them in the context of mutation testing. In this paper, search-based testing is used in order to effectively generate test inputs capable of revealing mutants. To this end, a dynamic execution scheme capable of introducing and guiding the search towards the sought mutants is proposed. Experimentation with the proposed approach reveals its superiority from the previously proposed methods. Additionally, the framework's feasibility and practicality of producing mutation based test cases are also demonstrated.

Introduction: The Practicality Gap in Mutation Testing

Software testing is a critical yet expensive phase of development, often accounting for over half of a project's total budget. Among various methodologies, mutation testing stands out as a powerful technique for assessing test suite quality. It involves introducing small, artificial faults—"mutants"—into the source code and determining if existing tests can detect ("kill") them.

Comparison of an original program and its mutated counterpart.

Despite its effectiveness, mutation testing remains underutilized in industry due to its high computational and manual costs. Generating test inputs that can specifically target and reveal these subtle mutations is a complex task. Most automated tools focus on simple code coverage, but mutation testing requires more: Reachability (executing the mutated line), Infection (altering the program state), and Propagation (ensuring the state change affects the final output).

Methodology: Search-Based Test Generation

The authors propose an automated framework that treats test generation as an optimization problem, utilizing the Alternating Variable Method (AVM)—a hill-climbing search algorithm. The search is guided by a sophisticated four-part fitness function designed to navigate the program's logic toward killing mutants.

Key Components

  • Mutant Schemata: To avoid the overhead of compiling thousands of individual mutant files, the framework uses "schemata" to embed all mutations into a single "meta-program." This allows for the evaluation of multiple mutants in a single execution pass.
  • Advanced Fitness Function: The search is guided by measuring the "distance" to a successful mutant kill. This includes approach level (path proximity), branch distance (condition flipping), mutation distance (state change), and impact distance (output disruption).
Fitness functions used to calculate branch distances for various logical expressions.
  • Dynamic Approach Level: Unlike static analysis, which can be misled by complex data dependencies, this framework uses runtime data to dynamically identify dependencies, improving search efficiency in complex logic.

Experimental Evaluation

The framework was benchmarked against 8 Java program units (e.g., Triangle, Calendar, Quadratic) using a total of 2,759 mutants.

Key Results

  • Performance: The search-based approach significantly outperformed random testing and traditional "reach-only" methods.
  • Higher Kill Rates: The proposed fitness functions killed between 113 and 122 more mutants than baseline methods.
  • Efficiency Gains: The "Dynamic Approach Level" provided a 7.6% improvement in kill rates over previous state-of-the-art search methods and a 7.9% improvement over random testing.
  • Effectiveness: In the Trityp benchmark, the "Impact" fitness function successfully killed nearly all killable mutants within 150,000 evaluations, demonstrating the potential for near-exhaustive automated testing.

Conclusion and Future Work

This research demonstrates that combining search-based optimization with dynamic execution data can bridge the practicality gap in mutation testing. While currently focused on intra-method testing, future work aims to extend the framework to handle complex object-oriented features and inter-class dependencies. Additionally, the authors plan to integrate evolutionary algorithms and automated detection of "equivalent mutants"—changes that do not alter program behavior—to further streamline the process.

Summary updated

BibTeX
@inproceedings{papadakis2013searching,
  author = {Mike Papadakis and Nicos Malevris},
  title = {{Searching and generating test inputs for mutation testing}},
  booktitle = {SpringerPlus},
  year = {2013},
  doi = {10.1186/2193-1801-2-121},
}
Figure