irongut / CodeCoverageSummary

A GitHub Action that reads Cobertura format code coverage files and outputs a text or markdown summary.
MIT License
193 stars 54 forks source link

Method Coverage #2

Open dberry-rcs opened 3 years ago

dberry-rcs commented 3 years ago

Feature Request

It would also be useful to have Method coverage reported by the tool.

Expected Behaviour

There would be an additional column that reports Method coverage

Additional Context

Similar to what is printed out by dotnet test:

Calculating coverage result... Generating report './bin/test-results/coverage.cobertura.xml'

+------------------+--------+--------+--------+ | Module | Line | Branch | Method | +------------------+--------+--------+--------+ | RCS.Libs.ArgUtil | 93.82% | 95.83% | 92.3% | +------------------+--------+--------+--------+

+---------+--------+--------+--------+ | | Line | Branch | Method | +---------+--------+--------+--------+ | Total | 93.82% | 95.83% | 92.3% | +---------+--------+--------+--------+ | Average | 93.82% | 95.83% | 92.3% | +---------+--------+--------+--------+

irongut commented 3 years ago

The Cobertura format doesn't include a method coverage value.

It would be possible while looping through the packages in the coverage file to loop through classes, loop through their methods and count the number of methods with line-rate > 0.0 and total number of methods. Method coverage could then be calculated as the ratio of line-rate > 0.0 : total methods. For a large project this could be slow so would be optional.

dberry-rcs commented 3 years ago

Optional would be fine.