Foreword

It’s taken quite a while but we finally have consensus around the idea that unit testing is a necessity for most of today’s projects. Occasionally, I see a voice in the wilderness challenge the idea - but just as quickly people who’ve been doing unit testing reflect back on their experience and notice the benefits that they’ve received. The idea of going without unit tests on a large project is just unthinkable for many people.

To me, this is success of the best kind - people are able to get more work done with less stress and fewer headaches. But that doesn’t mean that it’s all easy. Even though unit testing has been a strongly recommended practice since at least the early 2000s, people still struggle. They struggle because it is easy to get lost in the design decisions that you have to make when you are writing tests.

Tests are just as important as production code, but they are different. Through trial and error we are learning better practices but much of that knowledge is not yet widespread.

This is why I am very excited by Jay Fields’ book. I’ve known Jay for close to a decade and over that time I’ve seen him approach problems in software with conscientiousness and deep curiosity - trying things out, discussing them and not being satisfied with answers that don’t quite ring true. The book you’re about to read is a culmination of that inquiry. Reading it, you’ll learn a lot about unit testing. But, more than that, if you read between the lines you’ll learn a lot about how to see and think about software.

– Michael Feathers, Director, R7K Research & Conveyance