Problem solve Get help with specific problems with your technologies, process and projects.

Book excerpt: Pragmatic unit testing in C# with NUnit

This excerpt offers an introduction to unit testing and dispels some myths about its effects on productivity and an application's code base. defines unit testing as a process in which "the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation." Unit testing can be a manual process or an automated one -- but, either way, it can be a time-consuming, documentation-filled endeavor.

For .NET programmers using Visual Studio 2005, the only way to take advantage of unit testing functionality is by purchasing Visual Studio 2005 Team Edition for Software Testers. As a result, open-source unit testing tools such as NUnit proved to be quite popular. (Microsoft addressed this deficiency by adding integrated unit testing to Visual Studio 2008 Professional Edition.)

Pragmatic Unit Testing in C# with NUnit introduces ways that C# programmers can introduce better tests, and catch more bugs, without adopting methodologies like test-driven development or extreme programming.

The first chapter of the book provides an introduction to unit testing -- what it is, how it works, what benefits it offers and how it affects productivity. Authors Andy Hunt and Dave Thomas end the chapter by dispelling some common myths about unit testing, such as "It takes too long to run the tests" and "I don't really know how the code is supposed to behave so I can't test it."

Read "Introduction to unit testing"in this PDF file.


Excerpted from Pragmatic Unit Testing in C# with NUnit, First Edition (ISBN: 9780974514024) by Andy Hunt and Dave Thomas.
Copyright © 2004. Published by O'Reilly Media Inc.. Reprinted with permission.

Dig Deeper on .NET Framework security best practices

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.