Perl Testing Developers Notebook - Short Review

The Perl Testing Developers Notebook (PTDN) is the first of the O’Reilly Developers Notebook series I’ve read. The format’s good, a mix of the cookbook and hacks series, but does the substance match the style?

At nine short chapters this book packs a fair amount in. It starts with how to write, run and read tests in chapters 1 and 2. Moving on to using Devel::Cover (a chunk of chapter 3) and, in chapter 4, introducing Test modules that’ll help you cover your bases before releasing a module (or depending on your perspective make you jump through cargo coding hoops.) These early chapters provide a well written, nicely paced, introduction to Perl testing. If this is your first exposure to the Test:: Modules then this section will make your day, otherwise you’ll probably skim read it and won’t come back to this section, and chapter 4 in particular, after your first time through. The points it makes are sound but it lacks re-read value.

Chapters 5 and 6 cover replacing built-ins, mocking functions and objects and testing databases, both your interactions and the datasets. This is one of the best written examples of mocking using Perl that I’ve seen (although there isn’t exactly a surplus of decent perl mocking documentation, there is a lot of documentation mocking perl but that’s slightly different :)) and was the highlight of the book for me.

The book closes with chapters on testing websites (which gives some nice pointers to modules) and Apache modules, using Test::Class and using perl to wrap and test ‘other things’. I didn’t get a huge amount out of this section, beyond some pointers to modules I wasn’t aware of, and it felt like the coverage was quite shallow; it shows you what you can do but seems to stop too early.

In general, the books short size and lots of concise labs fit the “this module does this testing task” format nicely, it’s got quite a wide coverage for its page count and gives a number of pointers to modules that can make your testing life a lot easier.

Score: 7/10 if you’re just starting out in perl testing. 5/10 if you’re not (and most of that is for the mocking chapters).