code-coverage-api-plugin icon indicating copy to clipboard operation
code-coverage-api-plugin copied to clipboard

Overall line coverage is 100% but all lines are not covered

Open mikkhola opened this issue 2 years ago • 1 comments

Jenkins and plugins versions report

Environment Jenkins 2.387.1 Code Coverage API 4.2.2

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

Reproduction steps

  1. In our case coverage reports covers 31683 lines and there is one uncovered line (overall coverage 99.986%)

Expected Results

Despite the actual coverage being below 100%, the plugin incorrectly rounds it up to 100% in the overall code coverage view. For example, overall code coverage is 99.996% (one line not covered) but the plugin shows overall coverage as 100%. I know it is properly rounded from a math perspective but it should be 100% only if all lines are covered. This can lead to a false sense of code coverage completeness, potentially masking areas that need further testing.

Actual Results

Overall line coverage reported by the plugin is 100%.

Anything else?

No response

mikkhola avatar Jun 16 '23 11:06 mikkhola

Just for the record: The culprit seems to be https://github.com/jenkinsci/coverage-model/blob/d31981c893fd617a3a59578b3d46d71d11300c76/src/main/java/edu/hm/hafner/coverage/Percentage.java#L129, id est it just is a rendering issue (internally, the precise value is known).

stefan6419846 avatar Sep 06 '23 19:09 stefan6419846