Coming up to Speed

Learning a new practice like unit testing requires continual vigilance. Even if you enjoy writing unit tests and are good about covering the new code you write, you’re usually facing an uphill battle.

Perhaps your teammates are not as vigilant and are slamming out code at a rate that far outpaces your testing. Or, perhaps you’re close to a critical deadline, and your team insists that the only way to make the deadline is to toss all safeguards.

“Unit testing isn’t free,” says Pat, “We’re supposed to deliver in two weeks, and we’re way behind. We just need to slam out code.”

We’ve been there, however, and so has Dale, who responds to Pat, “The worst possible time to throw away unit tests is while in crunch mode. If we do, ...

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.