.NET mutation testing

NinjaTurtles is an easy to use open source .NET mutation testing framework. It gives you method-by-method tests for your C#, Visual Basic/VB.NET or other .NET language code, to help you maintain the quality of your tests as you code. NinjaTurtles integrates with your existing unit test framework, and you can write your code and tests in any .NET language.

Getting started is simple with the NinjaTurtles console runner – just point it at your tests and go:

NinjaTurtles.Console run -c ClassToTest TestAssembly.dll

Or you can add mutation tests to your existing test suite. Which is as simple as this (NUnit, C#):

[Test, MutationTest]
public void MethodUnderTest_Mutation_Tests()
{
    MutationTestBuilder<ClassUnderTest>
        .For("MethodUnderTest")
        .Run();
}

We believe that mutation testing fits hand-in-glove with test-driven development (TDD) and helps you maintain the “test-drivenness” of your code. Although mutation testing has a reputation for being slow and expensive to run, NinjaTurtles makes the additional burden low enough for it to become a key part of your testing strategy.

Installation

You can install NinjaTurtles using NuGet. The complete source code can be downloaded or cloned from CodePlex. If you prefer not to use NuGet, you can also download the NinjaTurtles binaries, including the console runner, from CodePlex.

Mutation testing variants applied

Currently, NinjaTurtles performs the following mutations of your code, at an IL level:

  • Sequence point deletion
  • Arithmetic operator substitution (*, /, +, - and %)
  • Bitwise operator substitution (&, | and ^)
  • Branch substituion (condition, always and never branch)
  • Conditional boundary substition (< and <=, > and >=)
  • Substitution of reads from variables, parameters and fields of the same type
  • Substitution of writes to variables of the same type

You can find full documentation on these in the documentation section. This also contains MSDN-style API documentation for developers.

Contributing to NinjaTurtles

The framework is designed to be extensible, and developers are encouraged to write their own turtles and submit them back to our Mercurial repository on CodePlex, either by forking and submitting a pull request, or by joining the project as a developer.