Skip to content
  Projet Triskell  


Document Actions
A mutation tool for AspectJ poincut descriptors.


AjMutator is a mutation tool for AspectJ poincut descriptors. It generates mutants by inserting faults in the PCDs. Each mutant is then compiled and classified. A test suite can then be run to proceed the mutation analysis and obtain a mutation score.


The latest version of AjMutator can be downloaded here:


AjMutator relies on ajc, ant, and JUnit.

In particular you should have the following jar files:

  • aspectjrt.jar (the aspectj runtime library, distributed with ajc)
  • aspectjtools.jar (also distributed with ajc)
  • junit.jar

Step 1: Generation

The fist step consist in generating all the mutants. This step is performed only once, unless you modify the mutated system.

To start, execute the following command:

java fr.irisa.triskell.ajmutator.AjMutatorGenerator <source folder> <results folder>

The source folder is where all the source files of the system (except test cases, see step 3) are stored. The results folder is where intermediate files, as well as the mutant files are stored. The source folder and the results forlder must be in different branch of the file system.

The generator will create the results folder if it does not exist and put the following files:

  • MutantInfo.xml: a model with information on the produced mutants. It is used at all steps of the mutation analysis.
  • compilation.xml: an ant build file for step 2.
  • mutants: a folder where the mutants are stored.

Step 2: compilation

To compile the mutants, you must execute the ant build file compilation.xml:

ant -f results/compilation.xml

The classpath in compilation.xml should be correctly set. At the beginning of the file there is an empty path element that should be correctly set. For instance:

<path id="classpath">
<pathelement location="/path/to/aspectjrt.jar"/>
<pathelement location="/path/to/aspectjtools.jar"/>
<pathelement location="/path/to/ajmutator.jar"/>
<pathelement location="/path/to/some/required/library.jar"/>

Do not forget to set the library your system relies on.

This step will generate:

  • one jar file (output.jar) for the original system, and one for each compilable mutant.
  • runner.xml: an ant build file for step 3.
  • originalWeavingInfo.xml: a model of the pointcut matched by each PCD of the original system. These file is only used for compilation and can be deleted safely.

The MutantInfo.xml model is also updated with the classification of each mutant.

Step 3: running the test cases

To run the test cases it is necessary to modify the runner.xml ant build file. As in the previous step the classpath must be set in the file. Do not forget top put junit.jar and your test cases in the classpath.

The property testClassName must be set with the correct value. It is the qualified name of a class implementing the interface junit.framework.Test.

Then you can execute the test cases with:

ant -f results/runner.xml

For each mutant the result is displayed in the console and stored in MutantInfo.xml. Finally the mutation score is displayed and stored in MutantInfo.xml. These information are reset to default each time the test are run.

It is a best to put the test files in another folder than the original system, otherwise the test cases are compiled in step 2. It is not a problem for running the test cases but it required to run again the compilation of all the mutants for each modificaion of the test cases.