a mutation testing engine for Java based on mutant schemata / metamutants / metaprogramming
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE.txt
README.md
pom.xml

README.md

metamutator: a meta-mutation tool for Java

Build Status

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.

Mutation operators

  • Logical comparison (switch between ">", ">=", "!=", etc) (LogicalExpressionMetaMutator).
  • Breaks the loops (no iteration, at 3 iterations, at 100 iterations) (LoopExpressionMetaMutator)
  • Adds unary operators to numeric values (absolute value, minus, increment (++), decrement (--)) (NumericVariableMetaMutator)
  • Sets variables to null at their declaration (VariabletoNullMetaMutator)
  • Replaces integer constants by 0, INT_MAX (IntegerConstantReplacementMetaMutator)
  • Metamutates return statements that returns Boolean (ReturnReplacementOperatorMetaMutator)
  • Skips statements (statement deletion operator) (StatementDeletionMetaMutator)

Usage

Let's assume your project is called foo and contains two folders src/main/java and src/test/java with a test class PgmTest.

  1. Create the metaprogram

    java -jar spoon.jar -i src/main/java -p metamutator.LogicalExpressionMetaMutator -o spooned

  2. Compile the metaprogram

    javac find spooned -name "*.java"

  3. Run the test class (with the metaprogram in the classpath and not the original program)

    MutantSearchSpaceExplorator.runMetaProgramWith(PgmTest.class)

Credits

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.