PexMutator: C# Code Testing Tool Based on Mutation Testing

Introduction

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 here

Usage

1. Create a method under test in a class, say TestMe, like:
class TestMe{
public int divideby0(int a, int b)
{
if (a < b)
return -1;
else
return 1 / (a - b);
}
}
2. Generate the corresponding dll file for the TestMe class, say TestMe.dll
3. Generate a test project using Pex, say TestMe.Test.
4. 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.
5. 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)
6. 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.

Contacts

Contact zhanglm07@sei.pku.edu.cn or Tao Xie for more details.

Last edited May 26, 2010 at 2:51 PM by zhanglm, version 13

Comments

No comments yet.