Martyn Bullerwell's blog

A New NUnit - xUnit.NET

As the .NET framework has moved on significantly since the introduction NUnit, the new framework needs to be more inline with the newer releases of the .NET framework, namely .NET 3.5 in Visual Studio 2008.  NUnit was widely accepted to support test driven development and became the defacto standard for test driven development, however lacked much support for other testing such as automated acceptance testing.  With this in mind XUnit has been developed which is a new testing framework, built upon NUnit.

Downloads are available here: xUnit.net

You will need .NET 2.0 or above, to install as it will not work on .Net 1.x, however you do not need visual studio!

Some Key Improvements include:

  • No Set up or Tear Down - This is no longer required although can be implemented, is now seen as an un-required overhead.
  • No Expected Exception
  • Aspect-Like Functionality - Support for example, to rollback database changes during testing
  • Reduction in custom attributes - such as TextFixture, SetUp, TearDown, ExpectedException and TestFixtureSetUp and Down.
  • Use of .NET 2.0 Generics - Allows more concise Assertions
  • Use of  .NET 2.0 Ananomys Delegates
  • Console based Test Runner (Unfortunately NO GUI yet...)
  • Assert extensibility - Allows custom comparers to be written, allowing for example, a Date comparer
  • Method extensibility - see  http://shareandenjoy.saff.net/2006/12/new-paper-practice-of-theories.html.
  • Class extensability - the definiation of Run test can be extended.

All in all it xUnit seems to have been stripped down form NUnit, however leveraging the .NET framework enhancements will make this new framework more extensible, and allow a more diverse range of automated testing and test driven development.