HTTPS SSH

MicroSpec is a tinyframework that allows you to write spec-style (Given-When-Then) tests with NUnit. Although spec-style tests are typically associated with Behaviour Driven Development (BDD) this way of defining tests can be very useful for communicating the intent of unit and integration tests. Furthermore, by using MicroSpec tests are better structured, easier to read, and easier to understand than traditional unit tests which often become unwieldy beasts even for mildly complex test scenarios.

MicroSpec allows you to define your tests as a series of steps that describe the conditions, actions, and expected results of the tests. Every step is defined as a method and can take parameters.

By following the naming convention for steps MicroSpec will produce textual output from the test on the console:

[Test]
public void add_two_and_two()
{
  Given(i_have_a_calculator)
    .When(i_add_0_and_1_, 2, 2)
    .Then(the_result_is_0_, 4);
}

//Output:
//Given i have a calculator
//  When i add 2 and 2
//  Then the result is 4