This part of the book reveals different strategies and techniques in testing. Here, we take a more scientific and theoretical approach to explain the differences. We talk about test quality, describe incorporating mock objects and stubs, and dive into the details of in-container testing.
Chapter 6 is dedicated to the analysis of test quality. It introduces concepts such as code coverage, test-driven development, behavior-driven development, and mutating testing. Chapter 7 is dedicated to stubs, taking a look at a solution to isolate the environment and make tests seamless. Chapter 8 explains mock objects, providing an overview of how to construct and use them. The chapter also provides a real-world example showing not only where mock objects fit best, but also how to benefit by integrating them with JUnit tests.
Chapter 9 describes a different technique: executing tests inside a container. This solution is very different from the preceding ones, and like them, it has pros and cons. The chapter starts by providing an overview of in-container testing. The end of the chapter compares the mocks-stubs approach with the in-container approach.