Other testing frameworks

The examples so far have assumed that you use NUnit for your tests. Here, we look at what happens if this isn’t the case.

Using other testing frameworks

NinjaTurtles constructs a list of tests to run, which is framework agnostic, but then it needs to know which test runner to use to actually run the tests. A test runner is a class that implements ITestRunner, and by default, NinjaTurtles will use the NUnitTestRunner, which spawns a process to run nunit-console.exe for each mutant.

Let’s now say, for the sake of argument, that you are actually using xUnit. NinjaTurtles already includes an xUnitTestRunner that will allow you to use xUnit’s own console runner to run xUnit tests. To use this, all you have to do is add a line to your fluent interface calls like this:

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

Note that the TestAttribute has changed into xUnit’s FactAttribute, but the MutationTestAttribute, which is part of NinjaTurtles, stays.

Runners supported

NinjaTurtles currently supports the following test runners:

  • NUnit (NUnitTestRunner)
  • xUnit (xUnitTestRunner)
  • MSTest (MSTestTestRunner)
  • Gallio (GallioTestRunner)