I’ve wanted to read this book for ages, and I finally found the time to sit down and enjoy it to the fullest. I’m tempted to end the review here and now, simply by saying that this book is great and you have to read it. So if you trust me you don’t have to read on, just read the book!
Roy Osherove is able to explain the concepts of unit testing in the simplest way possible, starting with the basics and moving on to the more advanced topics like writing testable code before finishing with an overview of design and process. This makes the book relevant whether you’re new to unit testing or refreshing your knowledge. All good so far, but what makes the book really shine is his thorough focus on best practices, how to write clean and maintainable unit tests. In other words, how to succeed with unit testing in the long run. He also gives an overview of how to fail with unit testing, giving real-life examples from projects he’s been working on.
The book was published in 2009, so the tools and testing frameworks used are a bit outdated. However, as the book is not written to teach you how to use a specific tool or framework, this doesn’t matter. What’s important is understanding why and when the tools are helpful and in what situations they are applicable. If you really want the tools and testing frameworks to be updated, you’ll be glad to know the 2nd edition is on its way.
The tone of the book is very informal, and it’s one of those books you can read just for fun. You don’t need to stack up on coffee beforehand, the book itself will keep you awake. What surprised me the most while reading it was the chapter on “Integrating unit testing into the organization”, which gives you advice on where to start if your company is not yet accustomed to unit testing, and how to get the managers onboard. It also contains all the answers to those difficult questions you will be asked if you decide to be the one to push for change in your company. I wish more books had a chapter like this! Being convinced by reading the book is a piece of cake, but being able to convince the rest of the organization can be quite a lot of work, and this chapter lightens the workload.
I could go on and on about how great this book is, but I’ll keep it short. I know for sure that this is not the only time I’ll read the book, I will probably re-read it over and over again to remind myself of Roy’s best practices. And I’ll definitely keep it close whenever I’m writing unit tests so that I can look up all his helpful tips when I get stuck. So go buy this book and enjoy! Or even better: wait until June when the 2nd edition is to be released!