Chapter 11Refactoring Tests

Your tests represent a significant investment. They’ll pay off in minimizing defects and by allowing you to keep your production system clean through refactoring. But they also represent a continual cost. You need to continually revisit your tests as your system changes. At times you’ll want to make sweeping changes and might end up having to fix numerous broken tests as a result.

In this chapter you’ll address problems in your tests that can lead to increased costs. You’ll learn to refactor your tests, much as you would refactor your production system, to maximize understanding and minimize maintenance costs.

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.