Pragmatic Unit Testing in Java with JUnit

Andrew Hunt, David Thomas (2003)
Review date: June, 2008
Summary

The first chapter motivates testing and gives some background. The following chapters comprise the mandatory introduction to JUnit: test suites, runners, and asserts. Then follow two chapters that introduce this book's unique selling points: Right-BICEP and CORRECT. Every letter in these acronyms denotes a memory rule, B for boundary conditions, P for performance, and so on. This is a rather good way of structuring things to think about when writing tests. Mock objects are also explained, but in a very basic fashion. The remaining chapters touch on topics like test properties, structure, and designing code for testing on a shallow level.

Opinion

The authors attempt to repeat the success of Pragmatic Programmer, a book that is sort of a classic. This book will not be as popular! It provides roughly 120 pages of light reading about testing, which is very little. However, the authors are honest about this being a beginner book.

I think structuring test properties around two easy-to-remember acronyms is a good thing. It provides a structure for the topic. The opposite can be quite frightening: I took a course in software testing once, and the course material was packed with important terminology structured for optimal immediate forgetting.

Enough on that. One of the opening sections is a real killer. It's called "Excuses for not testing", where the authors provide you with the standard list of excuses that flourish among lazy developers. This list feels painfully familiar and brings out a chuckle or two. In the latter part of the book the authors argue that test code be kept in as good shape as the production code, with which I agree whole-heartedly!

In summation: This is a simple, sympathetic book, with some insights and unique concepts, such as Right-BICEP and CORRECT, but at the end of the day it's too simple for a real professional.

Who should read this book

This is a great book if you know nothing about unit testing and want to get an overview mixed with some practical hints. People that work with, or manage developers and testers can read this book to get an introduction to unit testing.




News

  • 2015-09-29

    It's been almost one and a half year since I reviwed a book! I've been too absorbed by Writing my own. Anyway, I'm back with Jeff Patton's relatively...
  • 2014-01-04

    New category! Performance! Reviewed The Every Computer Performance Book. Check it out!
  • 2013-09-10

    Reviewed a book that' slightly less technical, but much more fun to read. It's I.T. Confidential.
  • 2013-08-13

    Reviewed yet another book on Visual Studio 2012 and TFS. I also created a "Microsoft" category and moved the other TFS book there from the "Tools"...
  • 2013-08-05

    Updated the FAQ. Included information about getting a book reviewed.