MbUnit vs. NUnit
Asked Answered
C

4

12

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?

Colombi answered 9/9, 2010 at 16:58 Comment(1)
possible duplicate of NUnit vs. MbUnit vs. MSTest vs. xUnit.netCatfall
S
10

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.

Sparky answered 9/9, 2010 at 17:40 Comment(4)
Yes, Nunit does have RowTest now. I have used both and they are very similar. MbUnit looks more pretty, lol.Colombi
I won't post any answer here because I actively contribute to one of those project and my opinion is biased. But I would just like to mention that [Row] is not the only way to make data-driven tests in MbUnit. There are several other convenient data source attributes (gallio.org/wiki/doku.php?id=mbunit:data-driven_testing) such as [Column] and [Factory] among many others.Circumvallate
NUnit has several other ways of doing row based testing as well. One of my favorites being using a method name of a method that returns test data.Bedder
Running regression testing with nunit was painfully slow. mbunit allows parallel out of the box so that in my mind is the one and only selling point. I've got many complaints aside from that but will continue to use mbunit until nunit fixes that hole.Unaware
C
15

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.

Cliff answered 9/9, 2010 at 22:39 Comment(0)
S
10

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.

Sparky answered 9/9, 2010 at 17:40 Comment(4)
Yes, Nunit does have RowTest now. I have used both and they are very similar. MbUnit looks more pretty, lol.Colombi
I won't post any answer here because I actively contribute to one of those project and my opinion is biased. But I would just like to mention that [Row] is not the only way to make data-driven tests in MbUnit. There are several other convenient data source attributes (gallio.org/wiki/doku.php?id=mbunit:data-driven_testing) such as [Column] and [Factory] among many others.Circumvallate
NUnit has several other ways of doing row based testing as well. One of my favorites being using a method name of a method that returns test data.Bedder
Running regression testing with nunit was painfully slow. mbunit allows parallel out of the box so that in my mind is the one and only selling point. I've got many complaints aside from that but will continue to use mbunit until nunit fixes that hole.Unaware
M
0

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.

Marnie answered 28/5, 2014 at 16:20 Comment(0)
E
0

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.

Erastus answered 7/7, 2015 at 9:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.