A port of Kent Beck and Erich Gamma's JUnit TestingFramework
for all languages on the .Net platform.
Currently at version 2.0. Versions 1.x were straight ports of JUnit. Version 2.0 has diverged a bit from JUnit and uses more .NET-specific idioms. For example, it takes advantage of custom attributes to avoid the need for inheritance from a common Test
Nov 2003 - New version available 2.1.4, lots of new features.
, Managed C++ and C# examples are provided.
There is also an NUnitAddin for VisualStudioDotNet
. It runs NUnit tests directly in the IDE:
See also TestDrivenDotNet
, a supporting VisualStudio
I think the old name of this page sucked, so I renamed it (and updated all links).
BTW I think NUnit is one of the better XUnits, especially the use of MetaData attributes instead of inheritance - unit testing should be a type of AspectOrientedProgramming, not part of your inheritance hierarchy.
I'm getting very hooked on Nunit. The whole concept of unit testing is very satisfying. I'm getting addicted to the GreenBar
. I have a couple of questions I'm hoping fellow Nunit Testers could help me with.
What is the best way to organize assemblies?
Do you include your test cases in the production code or in separate assemblies?
How do you combine each assembly's test code into a single integration test?
I am certain there are a number of ways to organize assemblies. The method I prefer is to create a separate Test assembly in my project/solution file. This way I can run my tests after each build by setting up the Nunit executable to run after the build is complete. In order for all tests from differing assemblies to run, create a Test Suite that combines all the Test Fixtures and run that. Also, for a release I can remove the assembly when shipping (if necessary).
That sounds like what I wanted to do, but I am a bit confused. If your tests reside in a separate assembly, how can they refer to (and thus test) classes in an exe assembly in the solution?
One easy solution is to put all your code into DLL assemblies, and let your EXE consist of only a simple Main() method.
Found a good tutorial on Test-driven Development using NUnit at http://www.parlezuml.com/tutorials/tdd_nunit/index_files/frame.htm
, a possible NUnit replacement.
See also NunitAsp
)components and programs.