Part 2. Testing strategies

Part 1 was about learning the basics of unit-testing with JUnit. However, just knowing how JUnit works and how to use it on simple examples is not enough when it comes to testing a real application. For that, JUnit alone is not enough; you need to develop testing strategies that allow you to unit-test a full-fledged application. The main issue is testing in isolation. When you’re writing unit tests, you want to test your application bit by bit. How do you separate bits of functionality so that they can be tested separately? Part 2 answers this crucial question.

Chapter 6 presents the stub strategy, which allows you to test relatively coarse-grained portions of code in isolation. In chapter 7, you’ll learn about a relatively ...

Get JUnit in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.