MutationTestBuilder Fluent Interface

For(string methodName)

Provides the name of the method that is under test. This is set up on your regular tests using the MethodTested attribute. This is a mandatory method name and is implemented as a static method for MutationTestBuilder<T>.

Parameters:
  • methodName: case sensitive string identifying the method.

Run()

Executes the mutation testing. Iterates over all the possible mutations for the method that you have requested through other fluent methods. If this is the only other method other than For(), all possible mutations will be run. This should be the final method in the chain, and returns void.

With<T>()

Identfies a type of mutation testing to perform. Possible values for T are:
  • ArithmeticOperatorTurtle
  • BitwiseOperatorTurtle
  • BranchConditionTurtle
  • ParameterPermutationTurtle
  • ShortBranchConditionTurtle
If the With<T>() method is not applied to the chain, all the above mutations are run.

ExpectedInvariantFor<T>()

Identifies when a method is expected to be invariant for a particular type of mutator. T is expected to be of type IMethodTurtle and can be any of the following:
  • ArithmeticOperatorTurtle
  • BitwiseOperatorTurtle
  • BranchConditionTurtle
  • ParameterPermutationTurtle
  • ShortBranchConditionTurtle

In the example SimpleCalculator solution, the Add method is invariant on ParameterPermutationTurtle since addition is not order dependant. Subtraction however is.

ExpectedInvariantFor<T>(string reason)

Overloaded method for ExpectedInvariantFor<T>() providing a reason for the invariant nature.
Parameters:
  • reason: string

CombineWith<T>()

This method allows you to implement your own mutator and combine it with the existing built in mutations.

UsingRunner<T>()

Identifies the type of runner to use when running the mutation tests. Possible values for T are:
  • NUnitTestRunner
  • MSTestTestRunner
By default, the NUnitTestRunner will be used.

Last edited Apr 19, 2012 at 7:59 AM by freaky, version 1

Comments

No comments yet.