Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy in %coverage shown by report generator vs visual studio 2015 #54

Closed
decentshakti opened this issue Jul 22, 2016 · 5 comments
Labels

Comments

@decentshakti
Copy link

We used report generator to generate html report for coverage generated by VS(Visual Studio 2015 Enterprise).
VS shows different coverage(see snapshot) than report generated by report generator(see snapshot).
The .coverage file is same for both.
VS uses "codecoverage.exe" to generate .xml. So, we use the same to generate .xml (using command line). So, the .xml file is also same for both.

Report Generator Snapshot: (Line Coverage = 60.1%)
capture
VS Snapshot: (Line Coverage = 58.59%)
capture

Please look into the issue.

@danielpalme
Copy link
Owner

Please see this thread for an explanation:
http://reportgenerator.codeplex.com/discussions/549025

@decentshakti
Copy link
Author

Thanks for the reply!
But as shown in the snapshot, VS also shows Line coverage?

On 7/22/16, Daniel Palme notifications@github.com wrote:

Closed #54.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#54 (comment)

@danielpalme
Copy link
Owner

Yes the numbers are a bit different. I don't know exactly how VS counts lines here.
ReportGenerator counts files twice if two classes are defined in a single file. That may explain the difference.

Without a concrete example I can't tell. If you find a concrete class or line where ReportGenerator shows an invalid coverage, please create an issue with corresponding screenshots or reports attached.

@krlydm
Copy link

krlydm commented Aug 21, 2017

Please see this thread for an explanation:
http://reportgenerator.codeplex.com/discussions/549025

@danielpalme: Unfortunately, link is not longer available. Can you share the explantation here?

@danielpalme
Copy link
Owner

@adam990i
VS uses blocks, see some explanation here: http://stackoverflow.com/questions/4958209/the-blocks-in-code-coverage-with-vs2010
ReportGenerator maps this to the lines of the source code and therefore shows "line coverage".

Since blocks and lines are not the same, the results may differ (23,70% <-> 25.29% coverage).

ReportGenerator parses all source files to generate the reports. If one file does not exist (any more), the corresponding warning is generated.
If you want an accurate report, all files should be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants