Overview
The Major mutation framework enables efficient mutation analysis of large software systems as well as fundamental research on mutation testing. Major provides the following three components:- Compiler-integrated mutator for easy and fast fault seeding
- Domain specific language to configure the mutation process in detail
- Mutation analyzer for JUnit tests
Generate mutants
Major provides a lightweight and easy to use mutator, which is integrated in the OpenJDK Java compiler.Generate and compile mutants
$javac -XMutator:ALL MyFile.java
#Generated Mutants: 190 (96 ms)
Generate mutated source files
$javac -J-Dmajor.export.mutants=true -XMutator:ALL MyFile.java
#Generated Mutants: 190 (223 ms)
Mutation analysis
The generated and embedded mutants can be used in any Java-based environment. Major provides a default mutation analyzer for JUnit tests that builds on top of Apache Ant.Apache Ant
Create target for mutation analysis
<target name="mutation.test">
<junit mutationAnalysis="true">
<classpath="build"/>
</batchtest>
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
Run mutation analysis
$ant mutation.test