MbUnit vs. NUnit

NUnit started as a port of JUnit, and has been around a long time. MbUnit came after the fact, and it brought "generative" unit testing. This means it has the ability to take a single unit test and generate several from it. One way to do this is the [RowTest] attribute.

Where a typical unit test will not take any parameters, a RowTest will take parameters and generate multiple tests from that. I believe that NUnit has the concept of RowTest now as well.

[Test]
[Row(1, 1, 2)]
[Row(2, 2, 4)]
[Row(1, 2, 3)]
public void X_plus_Y_equals_Z(x, y, z)
{
  Assert.AreEqual(z, x+y);
}

This will result in three tests being run in the test runner. There are also features for rolling back database transactions.

NUnit has the fluent interface for assertions, which is nice, but not really a selling point. NUnit probably also has some better tool support (ReSharper's test runner works with NUnit out of the box, but requires plugins for MbUnit).

In the end, you should pick one framework and go with it. The skills you pick up are very portable from one framework to another.


Even though NUnit now includes the most popular MbUnit advanced features, MbUnit is still more feature-rich, for example:

  • Contract verifiers
  • XML assertions
  • Serialization assertions
  • External data sources (CSV, XML, etc.)
  • Parallelizable tests

Fluent interfaces may be nice, but in general they don't add any new features. They just present things to the programmer in a different way.

NUnit is more popular because it was there first (therefore there are more articles about it on the web, and better tooling), and because most programmers don't care about or need the advanced features that MbUnit offers.