small medium large xlarge

Pragmatic Unit Testing in C# with NUnit (2nd edition)


Cover image for Pragmatic Unit Testing in C# with NUnit

Pragmatic Unit Testing in C# with NUnit (2nd edition)


Pragmatic programmers use feedback to drive their development and personal processes. The most valuable feedback you can get while coding comes from unit testing. Now in it’s second edition, Pragmatic Unit Testing in C# with NUnit, 2nd Ed. will show you how to do software unit testing, of course, but more importantly will show you what to test.

Customer Reviews

Using the approaches described by Dave and Andy you can reduce greatly the number of defects you put into your code. The result will be faster development of better programs. Try these techniques

- Ron Jeffries


Andy and Dave have created an excellent, practical and (of course) very pragmatic guide to unit-testing, illustrated with plenty of examples using the latest version of NUnit.

- Charlie Poole

NUnit framework developer

As part of the Mono project, we routinely create and maintain extensive unit tests for our class libraries. This book is a fantastic introduction for those interested in creating solid code.

- Miguel de Icaza

Mono Project, Novell, Inc.

The Pragmatic Programmers have done it again with this highly useful guide. Aimed directly at C# programmers using the most popular unit-testing package for the language, it goes beyond the basics to show what you should test and how you should test it. Recommended for all .NET developers.

- Mike Gunderloy

Contributing Editor, ADT Magazine

Anybody coding in .NET or, for that matter, any language, would do well to have a copy of this book, not just on their bookshelf, but sitting open in front of their monitor. Unit testing is an essential part of any programmer’s skill set, and Andy and Dave have written (yet another) essential book on the topic.

- Justin Gehtland

Founder, Relevance LLC

Pragmatic Unit Testing: in C# with NUnit_ helped me tremendously when I was first trying to come to grips with NUnit.

- Elisabeth Hendrickson

, Quality Tree Software, Inc.

I always get a delight when reading books from the Pragmatic Programmers series. They have a tendency to be light-easy reads that nevertheless manage to hammer home the key points and touch on modern techniques and tools to boot. ... I would recommend this book to anyone who was interested in learning about unit testing or any self-taught unit-testers who wonder if they are doing it right.

- Michael Minutillo

See All Reviews

Choose Your Format(s)

  • $20.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 176
Published: 2007-08-15
Release: P2.0 (2010-01-06)
ISBN: 978-0-9776-1667-1

New for the Second Edition:

  • Updated for NUnit 2.4 (C#, .NET 2.0, Visual Studio 2005, and Mono)
  • More NUnit assert methods
  • New String and Collection assertion support
  • Better support for multiple-platform development (Mono and .NET)
  • Higher-level setup and teardown fixtures
  • ...and more!

Without good tests in place, coding can become a frustrating game of “whack-a-mole.” That’s the carnival game where the player strikes at a mechanical mole; it retreats and another mole pops up on the opposite side of the field. The moles pop up and down so fast that you end up flailing your mallet helplessly as the moles continue to pop up where you least expect them. You need automated testing and regression testing to keep the moles from popping up.

You don’t test a bridge by driving a single car over it right down the middle lane on a clear, calm day. Yet many programmers approach testing that same way—one pass right down the middle and they call it “tested.” Pragmatic programmers can do better than that!

With this book, you will:

  • Write better code, faster
  • Discover the best hiding places where C# bugs breed
  • Learn how to think of all the things that could go wrong
  • Test pieces of code without using the whole .NET project
  • Use NUnit to simplify your C# test code
  • Test effectively with the whole team

Real software unit testing will make your life easier. It will make your software design and architecture better and drastically reduce the amount of time you spend debugging you .NET code.

Contents & Extracts


Andy Hunt and Dave Thomas are coauthors of the original Pragmatic Programmer, several books since, and founded the Pragmatic Bookshelf.