In our previous programming jobs, neither Gordon nor I had to do much testing. We tended to focus on architecture and development issues. Just prior to forming Infovark, we were acting as consultants for an ECM vendor that has since been snapped up by HP. So while we were aware of things like unit testing and test-driven development, we’d never had to do much of it ourselves.
We knew it was important, though. We’d seen too many things go wrong in software projects that didn’t make testing a core part of their standard operating procedures. So we incorporated testing into our product development and we’ve been learning about this testing stuff as we go. (It always happens that way, doesn’t it?)
We began with NUnit, the gold standard for unit testing on the .NET Platform, and quickly discovered some things that everyone else already knew:
In addition to these common nuggets of TDD wisdom, we also discovered something else: It’s dreadfully easy to shoot yourself in the foot with NUnit tests. It’s easy to write tests that aren’t atomic, for example, or tests that expect errors to occur in one line of code that pass because another line of code throws a similar error.
To address some of these quibbles, a splinter group has launched xUnit on CodePlex. It aims to simplify testing syntax, incorporate more .NET 3.5 constructs, and prevent some of the more common NUnit anti-patterns that testing neophytes (like us) regularly develop.
We’ve messed around with XUnit a bit, and so far we like what we see. It’s not enough yet to make us abandon NUnit though, especially with NUnit 2.5 on the horizon. Besides, the NUnit framework is integrated with a variety of other development tools we’ve found indispensable. (I.e., everything made by JetBrains.)
But that’s just our opinion. What do you think? How do these things stack up? And what about the testing framework built in to Visual Studio Team System? We’d love to hear your experiences with these tools.
2 Comments
Brad Wilson
A splinter group? You make us sound like a paramilitary open source organization bent on a coup.
Wait…
14 Jul 2008 04:07 pm
Alex Henderson
I just swapped across to xUnit for a project (from NUnit) and I’m loving it, especially the IUseFixture stuff, combined with AAA style syntax using the latest RhinoMocks I find myself writing a lot less cruft in my unit tests. Also the running of tests in a random order, and the encouragement to abandon state between each test works really well.
My only current annoyance is that I became accustomed to standard output / errors being displayed when running NUnit tests via TestDriven.Net – but running xUnit tests everything is conspicuously silent (I can see some logger output if I debug the test, but that’s pretty cumbersome).
23 Jul 2008 01:07 am
Leave a Comment