"xUnit Test Patterns: Refactoring Test Code" by Gerard Meszaros
My first reaction to the book xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros (Addison-Wesley) was shock: 800 pages on writing unit tests? Isn't that taking things a little too far?
I have a problem calling such an omnibus a "patterns" book. At 800 pages, xUnit Test Patterns is twice the size of Fowler's original Refactoring or Scott Ambler's Refactoring Databases. The value of patterns, in large part, came from creating a common vocabulary. I think it's perfectly legitimate to be discussing a problem and say "Visitor pattern" and expect that the response should be "Well, let's see..." I don't think that would be a legitimate expectation if I said "Hard-Coded Test Double."
Having said that, the omnibus of snippets has been a trend lately: the Cookbook series from O'Reilly and the Recipes series from the Pragmatic Programmers. The idea seems to be to beat Google at the "quick reference" problem: when faced with a problem, what's the fastest way to find a related snippet?
At that level, if you mentally retitle Meszaros' book "xUnit Cookbook/Recipes" then I think it accomplishes the job admirably: it seems to cover just about every problem scenario I could quickly think of. On the other hand, how many problem scenarios do you encounter running unit tests?
My take is that this is a good book to have in the shared library, but is unlikely to be fought over or, in the long run, thumb-worn and broken. I just don't see xUnit as being that complex or trouble-prone. And for those who don't "get" unit-testing, I think the book would be intimidating (even though a newcomer would do well to read the initial 275 pages, which amount to a book-within-a-book on unit testing).
If you're having trouble with unit testing, by all means, rush out and get it. But I can't help but feel that it could have been twice the book at half the length.