Skip to Content
Effective Unit Testing
book

Effective Unit Testing

by Lasse Koskela
February 2013
Intermediate to advanced content levelIntermediate to advanced
258 pages
7h 26m
English
Manning Publications
Content preview from Effective Unit Testing

2.5. Reliable tests are reliable

In the previous section I said that sometimes a test is testing something completely different than what you thought it tests. What’s even more distracting is that sometimes they don’t test a damn thing.

A colleague used to call such tests happy tests, referring to a test happily executing a piece of production code—possibly all of its execution paths—without a single assertion being made. Yes, your test coverage reports look awesome as the tests are thoroughly executing every bit of code you’ve written. The problem is that such tests can only fail if the production code being invoked throws an exception. You can hardly rely on such tests to watch your back, can you? Especially if the programmers have had a convention ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Art of Unit Testing, Second Edition

The Art of Unit Testing, Second Edition

Roy Osherove
Testing with JUnit

Testing with JUnit

Leonard Przybylski, Frank Appel

Publisher Resources

ISBN: 9781935182573Publisher SupportOtherPublisher WebsiteErrata PageSupplemental ContentPurchase Link