Search code examples
ruby-on-railsrubytestingcode-coveragercov

What's the difference between "total coverage" and "code coverage" in rcov?


When rcov generates a report, it shows "total coverage" and "code coverage" for each file. What's the difference between the two metrics?


Solution

  • From http://www.rubydoc.info/github/relevance/rcov/master/Rcov/FileStatistics

    total_coverage is:

    Total coverage rate if comments are also considered "executable", given as a fraction

    code_coverage is:

    Code coverage rate: fraction of lines of code executed, relative to the total amount of lines of code (loc).

    Unless a project's comments are considered executable, the most valuable metric will be "code coverage".