Part 1. Foundations
This first part of the book aims to give you, the reader, and me, the author, a shared context to build upon throughout the chapters. With the ultimate purpose of this book being to help you improve your ability to write good tests, chapter 1 begins with an overview of what kind of value we can extract from writing tests in the first place. Once we’ve discussed the dynamics of programmer productivity and the kind of impact that our tests—and the quality of our tests—can have on it, we’ll conclude the chapter with a brief introduction to two methods that are closely related to automated tests: test-driven development (TDD) and behavior-driven development (BDD).
Chapter 2 takes on the challenge of defining what makes for a good test. In short, we’d like to write tests that are readable, maintainable, and reliable. Part 2 will go deeper into this rabbit hole by turning the question around and reviewing a collection of examples of what we don’t want to get.
Part 1 concludes with chapter 3, which tackles one of the most essential tools in the modern programmer’s tool belt—test doubles. We’ll establish the legitimate uses of test doubles, such as isolating code so that it can be tested properly, and we’ll make a distinction between the types of test doubles we might reach out to. Finally, we’ll throw in guidelines for making good use of test doubles to help you get the benefits without stumbling on common pitfalls.