9.2. Speeding up test code
The essence of speeding up test code is to find slow things and either make them run faster or not run them at all. This doesn’t mean that you should identify your slowest test and delete it. That might be a good move, too, but perhaps it’s possible to speed it up so that you can keep it around as part of your safety net of regression tests.
In the next few sections we’ll explore a number of common suspects for test slowness. Keeping this short list in mind can take you quickly to the source of slowness and avoid the hurdle of firing up a full-blown Java profiler. Let the exploration begin!
9.2.1. Don’t sleep unless you’re tired
It might seem like a no-brainer but if you want to keep your tests fast, you shouldn’t let ...
Get Effective Unit Testing 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.