February 2013
Intermediate to advanced
258 pages
7h 26m
English
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 ...