metamutator: a meta-mutation tool for Java
metamutator takes as input a program and produces a metaprogram which contains all possible mutations inserted at compile-time according to a mutant schemata. It is a Java implementation of "Mutation analysis using mutant schemata". However, the mutations are all desactivated by default, meaning that the metaprogram behaves as the original one. Metamutants can be activated and desactivated one by one at runtime.
- Logical comparison (switch between ">", ">=", "!=", etc) (
- Breaks the loops (no iteration, at 3 iterations, at 100 iterations) (
- Adds unary operators to numeric values (absolute value, minus, increment (++), decrement (--)) (
- Sets variables to null at their declaration (
- Replaces integer constants by 0, INT_MAX (
- Metamutates return statements that returns Boolean (
- Skips statements (statement deletion operator) (
Let's assume your project is called
foo and contains two folders
src/test/java with a test class
Create the metaprogram
java -jar spoon.jar -i src/main/java -p metamutator.LogicalExpressionMetaMutator -o spooned
Compile the metaprogram
find spooned -name "*.java"
Run the test class (with the metaprogram in the classpath and not the original program)
Based on awesome code by Carlos Fau and Alejandro Russel (https://github.com/totemcaf/code-fixer/)
Great contributions from University of Lille's students enrolled in IAGL 2015-2016.