MbUnit - Unit Testing on Crack
MbUnit is a "better xUnit" that's used by a myraid of folks I respect, including James Avery, Patrick Cauldwell and Phil Haack. It's under very active development, even though I'd once wondered aloud if it was "abandonware." It's decidedly not and it's just got a new facelift to prove it.
Check out James Avery's Post called "I've seen the light and it is called MbUnitr." I've asked around and everyone has nothing but nice things to say what MbUnit brings to the table. It's NOT just NUnit with some tweaks. James says it's "Unit testing on crack."
Check this out...the test will get called four times, each time with different values passed in, some intending to cause and exception and others not. Very clean and certainly nicer than making a dozen methods like "NegativeTest54".
1 [RowTest]
2 [Row("James", "myemail@email.com")]
3 [Row("James", "", ExpectedException=typeof(InvalidUserException))]
4 [Row("", "myemail@emai.com", ExpectedException = typeof(InvalidUserException))]
5 [Row("James", "mybademail.com", ExpectedException = typeof(InvalidUserException))]
6 public void AddValidUser(string name, string email)
7 {
8 User u = new User();
9 u.Name = name;
10 u.Email = email;
11
12 u.Save();
13
14 User newUser = User.Retrieve(u.ID);
15 Assert.IsNotNull(newUser, "User not found");
16 Assert.IsTrue(newUser.Name == u.Name, "Name not saved correctly");
17 Assert.IsTrue(newUser.Email == newUser.Email, "Email not saved correctly");
18 }
It's even got a feature that will rollback database changes, keeping your database fresh after each test run. Sweet. I gotta do a show on Trends in Unit Testing...
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
The ONLY thing that could make MbUnit better would be if it would somehow magically release assemblies (or pull them in via Shadow Copy) each time it finished a batch of tests. I'm sadly quite an iterative tester at points and find myself constantly wanting to rebuild/tweak/etc, and therefore have to keep unloading and reloading my assemblies in the GUI otherwise I can't build correctly...
But yeah, stellar tool.
First, let me say that MbUnit is probably better than NUnit - I use both depending on which features I require.
However, no matter how many facelifts it's had (and it has moved about a few times since I started using it a year ago), I don't think that with the last release being an RC1 in February it can yet be labelled as anything other than Abandonware.
Hopefully, this will be the relocation that spells the beginning of a new development cycle.
Just my thoughts.
cool.
TestNG(http://testng.org/doc/ -- java unit testing library inspired from jUnit and NUnit) has been having this feature for a while . Yes, it is very useful.
BR,
~A
This is an integration test, not a unit test. The practical importance here is that an external resource is required for tests to pass. When running a unit test suite it is expected that no such setup is required. For example, a new developer should be able to grab code from source tree and execute unit tests with no failures.
-James
There has been work on the next version of MbUnit, version 3.0, going on for a little while. It is very early in the cycle.
Here is some impartial info on the project, you can make a more informed judgement.
Google Groups:
MbUnit.Dev - 62 Members with 60 posts last month
MbUnit.User - 120 Members with 35 posts last month
8 Dev Leaders with rights to Subversion
Here is the Svn FishEye:
http://www.mertner.com/fisheye/browse/MbUnit
4 Devs committing changes in Aug
264 files changes/28 revisions in Aug
To compare to NUnit
Mailing List:
Dev - 138 Members with 32 posts last month
User - 195 Members with 19 posts last month
7 Dev Leaders with rights to Subversion
Here is the Cvs commit list:
http://sourceforge.net/mailarchive/forum.php?forum_id=11797
2 Devs committing changes in Aug
? file changes/12 revisions in Aug
Cheers,
Aaron
P.S. This might be a double post. The page recycled with no indication of success or failure the first time I submitted.
MbUnit has 10 bug reports http://www.mertner.com/jira/secure/Dashboard.jspa
NUnit has 34 bug reports http://sourceforge.net/tracker/?group_id=10749&atid=110749
That is a limitation of VB.NET. If you need help with MbUnit the best place to go is the Google group.
http://groups.google.com/group/MbUnitUser?lnk=oa
or for Devs of MbUnit
http://groups.google.com/group/MbUnitDev?lnk=oa
If you search in the group for your problem I know that you will find a thread dealing with your exact issue.
Smiles,
Note that this build does not have the issue reported by Jeff Campbell above.
As to the question of "abandonware," I think that if you need to download a new unit testing framework every couple months then something is wrong. New builds were made available, for example, with the release of .NET 2.0 to make it available for that environment. I prefer to see it as a stable product, that people are using the real world.
And yes, some of what makes MbUnit popular is that you can use the same framework for integration testing. Some people might not want to blur this line, and might be philosphically happier with NUnit. A lot of us like MbUnit because it just gives us a way to test whatever we think needs testing.
I don't think that the lack of new releases is the main reason for the product looking like 'Abandonware', it is the fact that the last release, in February, was an RC.
Maybe I look at things differently, but I definitely expect to have a final release a few months after the last RC, or is that not the case?
Like I said, I think that due to it's feature set, MbUnit probably beats NUnit, and I have duly downloaded 2.3.71 from the link posted ;)
Comments are closed.