Increasing test coverage
Among the metrics for measuring code quality, there is one that is especially difficult to understand, and that is test coverage. Test coverage is a dangerous metric because a really high coverage does not imply the code is well tested. As the name says, it only contemplates whether a piece of code has been triggered and hence executed by a test. For that reason, the goal of testing is basically a combination of good tests and good coverage. To summarize, it is the quality of tests that matters, the code coverage is secondary.
There are some scenarios though where code coverage is indeed a good indicator. These are when the code coverage is really low. In those, the number means a greater part of the codebase is not ...
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