This project has moved. For the latest updates, please go here.

Feature Request: make the percentages 2 digits by default

Sep 20, 2012 at 2:44 PM

We have a continuous improvement workflow, and due to the number of lines of code, having percentage stop at the first decimal digit does not give enough granulraity of improvement.

Code used is this (With a few changes:

return (this.CoverableLines == 0) ? 0 : Math.Round((decimal)100.0 * this.CoveredLines / this.CoverableLines, 2);
Sep 21, 2012 at 9:55 AM

I'm not sure if this feature would really help to write better code.

Code coverage (especially line coverage) is a tool, which helps you to identify code regions that are not covered yet.

A covered line means: "this line has been executed". It does neither make any guarantees, that a suitable Assert statement exists, nor does it assure that all branches in a line have been covered.

That means, if you want to get your unit tests "right", then you have to take a closer look at the code together with the coverage results.

If you make assumptions about your test quality based on: "I have a coverage of 80.14%" instead of "I have a coverage of 80.1%", then you are probably doing it wrong. If you really want to work on that level, you could also have a look at "Covered lines", "Coverable lines" and "Total lines". The quota is not that important.

What do you think?