I bought “Python Testing Cookbook” by Greg L. Turnquist, published by Packt.
The good. I liked the cookbook recipe approach. Each recipe has the same headers: Its name, “How to do it,” “How it works,” and “There’s more.” This may not sound fancy, and it isn’t, but it works.
The writing’s good (albeit sometimes elementary — see below) and the example code is well laid out (except when it isn’t — see below). The book starts with the simplest form of unit testing, and goes all the way to measuring test coverage, and load testing. That’s a lot for one book to cover, which is both good and bad. Your first line of defense can be one book, but unless the book is very well written, it may leave every reader scratching their head over one section or another.
I learned a couple of new tricks.
The bad. Poor editing. I wasn’t looking for mistakes, yet within the first 50 pages I found three grammatical and two code layout errors. Technical book publishers like Packt have gotten lazy in the past 10 years, by cutting back on editing because the web lets them easily distribute errata. Except that some readers, like me, will be ticked off. Attention Packt: I’m now less inclined to buy your books because of your inadequate editing; factor that into your profit strategy.
In places, the writing was oddly simplistic. (“Is it clearer where the bug is? Was it worth the effort?”) (“This reads like a 9th grade social studies textbook? Was it worth $39?”)
The meh. Some of the recipes are so obviously not the right thing to do, that nobody would use them in a non-trivial project. The book starts the reader with the most basic of approaches to unit testing. Then, introduces automatic test runners! Then, testing edge cases! Etc. Five pages describing a technique you’d never use is five wasted pages.
This book reads in parts like a general introduction to testing, and in other parts like a survey of Python testing tools and techniques, and in yet other parts like a testing technique reference. We need introductory and advanced books, and it’s possible for one book to properly fill both needs if it has the proper organization and writing style. This one, not.
Summary. If you’re a newbie to Python testing and are willing to overlook the editing, this book rates a B.
If you’re an experience developer, this book rates a C+. I paid $39 and feel ripped off. If you can buy a copy for less than $25, it’s worth a spot on your shelf.