The Mutation Process
One iteration of the mutation process involves the creation of mutants, executing unit tests with mutants in the place of source code, and comparing the results of the mutants output to the results of the original (see above Figure).
Mutants are modifications of source code that have been modified by mutation operators. The primary concept behind mutation testing is that modifying the source code of a given unit (or mutating it) should cause the test that operates on that unit to fail.If a class is mutated, it should cause the test cases to fail or produce different results than the original (except in the case of a false positive).
Figure: The Mutation Testing Process (click to enlarge)
If the mutation procedure reveals a true positive, the developer then knows that there is a weakness in his or her test code: if changing the code does not produce a test failure, the test is missing something. The developer studies how the mutant is different from the original, and tries to write a test that will catch this possible error, thus beginning a second iteration of the process. In this way, the mutation testing procedure helps the developer to create strong test sets.
MuClipse
The
Eclipse development environment provides many project management and development interfaces that greatly enhance designing and implementing a Java project. Specifically, it provides an API which makes performing mutation testing easier.
MuJava, by Yu Seung Ma,
Dr. Yong Rae Kwon and
Dr. Jeff Offut, is a Mutation System for Java files. Using
OJ, MuJava provides both a user interface and an API for performing mutation on existing Java classes. After performing either method-level or class-level mutations on specified Java classes, MuJava runs testcases on the original classes and again on the mutants and compares the result, thereby implementing the Mutation Process described above.
MuClipse is an
Eclipse Plugin which provides a bridge between the existing MuJava API and the Eclipse Workbench.
MuClipse is a reincarnation of the MuJava tool in the form of an Eclipse plug in. The mutation process requires a large amount of meta-language manipulation. Since mutation operators act on the source code, the produced mutant has to then be compiled before it can be run against the test cases. In addition, mutation testing requires that the mutant's source code not be on the Java classpath if you are attempting to "kill" it. Both of these steps require very specific Java runtime settings, which are handled by the configurations that come with the MuClipse installation.
MuClipse provides advances for the MuJava system in the areas of usability and compatibility. The following improvements help explain its motivation:
- Classpath Management
- Directory Structure Configuration
- Runtime Configuration
- Integrated GUI-based Results
- Compatibility with jUnit TestCases