Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Part 2: Different testing strategies - Pg. 65

Part 2 Different testing strategies his part of the book reveals the various strategies and techniques used in testing. Here we take a more scientific and theoretical approach to explain the differences. We describe incorporating mock objects, or stubs, and dive into the details of in-container testing. The first chapter of this part describes different techniques for improving the quality of your tests--measuring test coverage, practicing test-driven develop- ment, and writing testable code. The sixth chapter of the book is dedicated to stubs. We look into another solution to isolate the environment and make our tests seamless. The seventh chapter starts by explaining what mock objects are. We give a thorough overview of how to construct and use mock objects. We also give a real- world example showing not only where mock objects fit best but also how to ben- efit by integrating them with JU nit tests. The last chapter describes a totally different technique: executing tests inside a container. This solution is different from the previous ones, and just like them it has its pros and cons. We start by presenting an overview of what in-container means and how it's achieved, and at the end of the chapter we compare the mocks/stubs approach to the in-container approach. Along with the theoretical benefits, this chapter serves as a good starting point to under- standing chapters 13 and 16. T