Monday, May 28, 2012

A brief survey of the various .NET unit test frameworks

In summary, someone please fix NUnit to support async task methods.

MSTest

Pros: Best IDE experience for VS2010 and earlier (VS 2012 supports MSTest and other frameworks equally).

Cons: It requires an expensive product to develop and run.  ExpectedExceptionAttribute considered harmful.

NUnit

Pros: Supports Fluent syntax.  Attributes can specify that tests require STA, MTA, etc.

Cons: No support for “async Task”.  Reuses test class instance for all tests within that class.

xUnit

Pros: Very few attributes keeps it simple.  Straightforward use of constructors and Dispose methods to wrap tests.

Cons: Assert.Equals doesn’t allow accepting a formattable message to provide a more useful failure message.  No Assert.Inconclusive.