NUnit is a Unit Test framework for the .NET languages. NUnit 1.x was straight port of the JUnit 3.8. With the 2.0 version NUnit was rewritten and redesigned as .NET application making use of Attributes instead of special methods and base classes.
Five versions and over five years later version 2.5 is in Alpha. This release includes support for:
- Data Driven tests - using [TestCase] and [DataSource] allows data to passed into the test case via the Attributes.
- Parallel and Distributed testing - a new test runner (PUnit) allows tests to run in parallel over several machines. This test runner was developed to help with the stress testing of a server.
- Additionnal Asserts: Support for comparing file paths or directories without accessing the file system. More support for testing whether code does or doesn't throw an exception.
- Run CSUnit tests: The CSUnitAddin supports running tests from another one of the major .NET test frameworks.
- RowTestExtension: Allows developers to write RowTests for NUnit an alternative to NUnits [TestCase].
- In addition the documentation has been updated.
Other Major Features
- Constraint based Assert model: In addition to the traditional assertions, NUnit allows you to say: Assert.That(myString, new EqualConstraint("Hello")); giving the user the flexibility to add their own constraints that are full participants in the NUnit eco-system.
- Attributes that support declaring: Tests, Setup, Teardown, Fixture Setup/Teardown (per namespace setup/teardown), ...
- Console and GUI test runners
Charlie Poole has also written to clear up confusion around the different versions of NUnit:
A few folks are confused by the various release numbers being announced or discussed all at one time, so I thought I’d clarify:
NUnit 2.4.7 is the latest production release of NUnit. It’s the one we recommend most people use for your tests. Some fairly critical performance bugs have been fixed in the last few releases, so you should update even if you’re only one or two digits back. See what you’re missing !
NUnit 3.0 is the planned - but not yet released - next generation NUnit. We call it the NUnit Extended Testing Platform, to distinguish it from the current NUnit Framework. It will provide a superset of the functionality of the current framework and is generally described here. I’ll be posting further info on NUnit 3.0 as it progresses.
NUnit 2.5 is release that wasn’t originally planned. The 2.4 series was supposed to be followed by 3.0. However, a number of people asked for a quicker release that included features provided by other test frameworks, which are currently missing from NUnit.
Other .NET Unit Test tools include: MBunit, CSUnit, xUnit.Net, NBehave and Gallio - an open, extensible, and neutral test runner designed to support all .NET test tools.