Many tools can help you perform unit testing. Since TDD's rise in popularity in 2005, the market for frameworks and tools has exploded. One of the most popular types of unit testing tools are unit test frameworks. These frameworks let you define your unit test code, control the execution of the tests, and provide an application to run the tests and report on the success of each test in your test suite. NUnit is one of the most popular and mature of the .NET unit test frameworks.

What Is a Unit Test Framework?

Before unit test frameworks, developers had a difficult time creating executable tests. The initial practice was to create a window in your application that was dubbed the “test harness.” This was simply a window with a button for each test. The results of the tests were either a message box or some sort of readout on the form itself. With a button for each test, these windows soon became crowded and unmanageable. Some enterprising developers moved to using console applications that would execute each test and output the results to the console. This was a step forward in that developers could spend more time on their test and less on their test harness. It also had the benefit that you could easily have it run automatically from a build server.

These methods worked to a degree, but they didn't provide a common means for creating, executing, and interrogating tests. Unit test frameworks such as NUnit sought to provide those features. Unit test frameworks ...

Get Professional Test-Driven Development with C#: Developing Real World Applications with TDD now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.