11.6 Using the Code Coverage Metric Effectively
Code coverage —the percentage of lines of code exercised by your unit tests—is the new “lines of code” metric, sure to be abused by lazy managers. The naive interpretation of the metric is that 100 percent means you have comprehensive coverage, and 0 percent indicates that you haven’t even tried. You can find a number of code coverage tools for C++; most are not free. COVTOOL ( http://covtool.sourceforge.net ) is one open source test coverage tool.
A good coverage tool will also annotate your source, showing you specifically which lines of code get executed when you run your tests. The real value in measuring coverage lies here: knowing which lines of code aren’t covered can help you determine ...
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