REVIEW

Book Review: Pragmatic Unit Testing in C# With NUnit by Andrew Hunt and David Thomas with Matt Hargett

Written by T. Michael Testi
Published October 25, 2007

According to the authors, "You don't test a bridge by driving a single car over it on a clear, calm day. Yet many programmers approach testing that same way - one pass down the middle and they call it tested." Pragmatic Unit Testing in C# with NUnit wants to change all of that. In this book, Andrew Hunt and David Thomas with Matt Hargett want to show you how to use real unit testing to make your life easier, and your software more reliable.

Pragmatic Unit Testing is 227 pages that divided into 10 chapters and four appendixes. To work with this book you will need a copy of NUnit that is available for free download. While this book features a .NET version of NUnit, there are many other languages that support a version of NUnit as well.

Chapter 1, "Introduction," begins by describing what Unit Testing is, and why one should bother with it. The basis for unit testing is that when you write a unit of code, you should test that the unit does what it is supposed to do. That is, does the code fulfill our intent? Does it do it all of the time? And can we depend on it?

Chapter 2, "Your First Unit Test," shows how you should begin to plan your test, how to test a simple method, and how to run it with NUnit. Several methods are explained such as from the command line or with the GUI. Chapter 3, "Writing Tests in NUnit," explains how to structure a unit test by first looking at the classic "Assert," which is the fundamental building block to NUnit. Also examined is the difference between test code and production code.

Chapter 4, "What to Test: The Right BICEP," looks at how to tell if the results are right. Here you will look at what kinds of things might need testing. You will examine boundary conditions, inverse relationships, cross checking and force error conditions. Chapter 5 is called "CORRECT Boundary Conditions." Because boundary conditions are such a common source of bugs, a whole chapter is devoted to it. Topics such as Conformance, ordering, range, reference, cardinality, and time become of interest.

page 1 | 2
T. Michael Testi is a photographer, writer, software developer and ardent fan of fantasy football and horse race handicapping. He also blogs at PhotographyTodayNet and at All This and Everything Else.
Keep reading for information and comments on this article, and add some feedback of your own!
Book Review: Pragmatic Unit Testing in C# With NUnit by Andrew Hunt and David Thomas with Matt Hargett
Published: October 25, 2007
Type: Review
Section: Books
Filed Under: Books: Computers and Internet, Review, Sci/Tech: Computers, Sci/Tech: Internet, Sci/Tech: Programming, Sci/Tech: Software
Part of a feature: The RAM Review
Writer: T. Michael Testi
T. Michael Testi's BC Writer page
T. Michael Testi's personal site
Spread the Word
Like this article?
Email this
Submit to del.icio.us Save to del.icio.us
RSS Feeds
All RSS Feeds (240+)
Comments on this article
Articles in this series
BC articles by T. Michael Testi
Books: Computers and Internet
Review
Sci/Tech: Computers
Sci/Tech: Internet
Sci/Tech: Programming
Sci/Tech: Software
All Books Articles
All Review articles
All BC articles
All BC Comments

Comments

Want comments emailed to you? No spam, promise! Address:

Add your comment, speak your mind

(Or ping: http://blogcritics.org/mt/tb/70176)

Personal attacks are not allowed. Please read our comment policy.





Remember Name/URL?

Please preview your comment!

Fresh
Articles
Fresh
Comments