26

It seems to me that everyone uses NUnit without even considering the other options. I think this is because:

  • Everyone is familiar with it already so they won't have to learn a new API.
  • It is already set up with their continuous integration server to work with NUnit.

Am I wrong about this?

I decided to use xUnit on one of my own projects recently and I love it! It makes so much more sense to me and conceptually it seems like a definite step forward from NUnit.

I'd like to hear opinions on which framework is actually the best - not taking into consideration having to learn it or reconfigure your automated testing.

Nobody
  • 2,613

4 Answers4

15

MSTest

I personally use MSTest. NUnit is really nice, but in VS2010, MSTest is already fully integrated into the IDE and there are full project templates for it. For .NET, if you're using 2010, then I think MSTest is the way to go (MSTest in VS2008 I don't think is up to par) simply for the code coverage, test runner and other tools that are available to you out of the box. (If you use CodeRush or R#, then they have really great test runners/tools for other testing frameworks)

Edit: I've since moved on to XUnit. :D

Ryan Hayes
  • 20,109
14

I've started to use Gallio/MbUnit several years ago. And the features and gems it provides are just so powerful that I've never regretted my choice. In fact, I'm now part of the development team of the Gallio OSS project; so I can contribute to make it even more awesome.

  • MbUnit has many powerful features that just make my developer life easier (contract verifiers, test factories, structural equality comparer, combinatorial tests, data generation framework, text diffing, xml assertions, extension points, etc.)
  • Gallio provides a consistent platform to run all my tests with a nice reporting tooling. I'm also fond of the fact that I can integrate tests from other OSS projects which do not use MbUnit and just run them along. Seamless integration within many 3rd party tools is also convenient (R#, PoSh, dotCover, etc.) And the extensibility of the infrastructure is amazing (for example, I've just finished to write a test adapter for a native unmanaged C++ testing framework. It will be part of a future release soon)

The wiki is certainly a good starting point to discover Gallio and MbUnit v3. It sill misses some chapters but it's quiet useful already.

9

Picking one and using it is perhaps the most important step here.

Personally I would choose NUnit for a few reasons. First and foremost is tooling support. There is a free add-in for Visual Studio 2010, and all major 3rd party plugins support it. Every single build system, test coverage utility and CI server supports it. In many cases without a plugin. On the code level, it can handle just about any scenario at this point -- data driven tests, inheritance, abstract test classes, generic test classes, setup, tear down, etc. To some extent we have xUnit because NUnit got too feature rich and powerful.

Beyond NUnit, I think you could make a pretty decent argument for MBUnit + Gallio as mentioned by Yann -- it is a very solid framework. The one you should avoid if at all possible would be MSTest, which has a few fatal flaws IMHO. Flaws being some of the constraints on your test classes, such as no inheritance, and dependencies on professional or better visual studio SKUs. Including requiring visual studio be installed on the build server in order to run the tests.

Wyatt Barnett
  • 20,787
0

The one reason is NUNIT become more industry standard than xUnit. But personally, i love xunit.

Cheung
  • 103