Chapter 2. In search of good
In this chapter
We’re on a journey of learning about good tests. We want to learn to identify good tests, write good tests, and improve not-so-good tests so they become good tests—or at least closer to being good tests. The question is, What makes a test “good”? What are the magic ingredients? There are several aspects to consider, including:
- The test code’s readability and maintainability
- How the code is organized both within the project and within a given source file
- What kinds of things a test is checking for
- How reliable and repeatable a test is
- How a test makes use of test doubles
We’ll be taking a closer look at all of these aspects in this chapter.
The preceding list is far from being comprehensive. The range of factors that may tip your test-quality scale either way is endless. Similarly, some of the factors don’t matter that much in all contexts. For some tests, their execution speed may be crucial, whereas for other tests, being extremely focused is key.