Xaisoft
Xaisoft

Reputation: 46591

MbUnit vs. NUnit

I read that MbUnit is NUnit on steroids, but I don't see why. From what I have read on here, I hear that NUnit is more popular over MbUnit. One of the main reasons is because it has a fluent interface. Is this the only reason?

Why should I prefer MbUnit over NUnit, or vice-versa?

Upvotes: 12

Views: 9178

Answers (4)

Mike Kozhevnikov
Mike Kozhevnikov

Reputation: 21

The MbUnit plugin is available only for ReSharper 6 (without any excess manipulations). So if you use Visual Studio 2012 or Visual Studio 2013 you have to use a newer version of ReSharper which supports NUnit out of the box.

Also it looks like MbUnit and Gallio is no longer supported.

Upvotes: 0

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

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

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.

Upvotes: 15

NerdFury
NerdFury

Reputation: 19214

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.

Upvotes: 10

Joe Schrag
Joe Schrag

Reputation: 865

Just a note for those doing research:

From MbUnit's site: "Gallio and MbUnit are currently on hiatus."

The MbUnit GitHub account shows an extremely sparse commit history of late.

Upvotes: 0

Related Questions