So, let’s start at the foundational level: 100% code coverage is a fallacious goal. Unit testing is designed to provide two principal benefits: 1) validate the operation of code; 2) create sensors that can detect when code operation has changed, thereby identifying unanticipated effects of code changes. There is no point in writing tests that do not fulfill one of the two goals.
So says an exceptional blog post by my good friend and colleague Andrew Binstock. “The Fallacy of 100% Code Coverage” is one of the most meaty, yet concise, discussions of code coverage that I’ve encountered. Read it, and read the many comments too.
Did you know that Andrew’s seminal 1995 tome “Practical Algorithms for Programmers” (co-written with John Rex) is still in print? I’ve got to get him to autograph my copy one of these days.