PexMutator: C# Code Testing Tool Based on Mutation Testing
Existing test-generation techniques do not provide effective support for killing mutants in mutation testing. Here we develop a novel test-generation tool, called PexMutator, for mutation testing using Dynamic Symbolic Execution (DSE), a recent effective test-generation
technique. Based on a set of transformation rules, PexMutator transforms a program under test to an instrumented meta-program that contains mutant-killing constraints. Then PexMutator uses Pex, a state-of-the-art DSE engine, to generate test inputs for the
meta-program. The mutant-killing constraints introduced via instrumentation guide Pex to generate test inputs to kill mutants automatically.
PexMutator generates the meta-program at the compiled-file level directly. PexMutator is developed using the
Common Compiler Infrastructure
, which provides functionality for reading, writing, and manipulating Microsoft Common Language Runtime (CLR) assemblies using a hierarchical object model. In the implementation, PexMutator reads the assemblies of the original
program under test and generates the corresponding meta-program in the form of assemblies.
Sources of PexMutator V1.1 can be downloaded from
Create a method under test in a class, say TestMe, like:
public int divideby0(int a, int b)
if (a < b)
return 1 / (a - b);
Generate the corresponding dll file for the TestMe class, say TestMe.dll
Generate a test project using Pex, say TestMe.Test.
Copy TestMe.dll to the directory of mutator.exe, use the mutator.exe generated by PexMutator1.1 in the command line like this:"mutator TestMe.dll". Then Mutated_TestMe.dll will be generated as the instrumented dll file.
In the generated TestMe.Test project, change the reference of TestMe.dll to Mutated_TestMe.dll(NOTE: before changing the reference, you should change the name of Mutated _TestMe.dll to TestMe.dll, otherwise Pex will not recognize the code)
Right click the corresponding PUT method, select "run Pex Explorations", then the meta-program will guide Pex to generate test inputs to kill mutants automatically.
for more details.