Eliminating Non-Tests
Assertions are what make a test an automated test. Omitting assertions from your tests would render them pointless. And yet, some developers do exactly that in order to meet code coverage mandates easily. Another common ruse is to write tests that exercise a large amount of code, then assert something simple—for example, that a method’s return value is not null.
Such non-tests provide almost zero value at a significant cost in time and effort. Worse, they carry an increasingly negative return on investment: you must expend time on non-tests when they fail or error, when they appear in search results (“is that a real test we need to update or do we not need to worry about it?”), and when you must update them to keep them ...
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.
Read now
Unlock full access