question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mismatch between Branch Coverage in Cobertura and HTML reports

See original GitHub issue

We are generating code coverage using dotnet test, coverlet, and cobertura. We are using ReportGenerator to combine the coverage results and generate both Cobertura and HTML reports. We are also integrating with Build Quality Checks to gate the builds if line or branch coverage dips below a certain threshold.

We would very much like for the HTML reports to show the same numbers that the build gates will trigger off of. It’s obviously very confusing to see a build fail because branch coverage is too low, but look at the Code Coverage tab and see that it’s clearly above the require threshold.

I know this is related to other issues that have been closed related to how RG counts branches vs. how cobertura does. However, since RG is responsible for generating the combined cobertura.xml file, couldn’t it use its own count when generating the coverage element in that file so that it matches the HTML output?

See related issue here with screenshots and more details: https://github.com/MicrosoftPremier/VstsExtensions/issues/120

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ardaliscommented, Oct 14, 2020

Problems solved!

In working with the team that had this problem I discovered that while they were combining 3 cobertura files, they were only running 2 tests (the 3rd was commented out). However, the 3rd had its cobertura.xml file checked into source control (some time ago) so it was being combined via RG with the other 2.

The lack of the disable.coverage.autogenerate: 'true' hid this problem since the HTML seemed to show the right result. Adding that in got the HTML report to match the RG-generated cobertura.xml file. Removing the old cobertura coverage file from source eliminated the problem entirely.

0reactions
ardaliscommented, Oct 14, 2020

Yes, I’ll email them today from my client computer. We did manage to get consistent results between HTML and cobertura.xml files by setting the disable.autogenerate to true. Unfortunately, it’s now reflecting the low coverage numbers in both places, because it’s not taking into account our exclusions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reporting Angular 2 code coverage in Jenkins
Reporting Angular 2 code coverage in Jenkins - mismatch between coverage categories. We used the Publish Cobertura Coverage Report plugin for ...
Read more >
SonarQube and code coverage - Guides - Sonar Community
Code coverage is an important quality metric that can be imported into SonarQube. The coverage report has to be computed by an external...
Read more >
Test coverage visualization | GitLab
This allows you to see which lines are covered by tests, and which lines still require coverage, before the MR is merged. Test...
Read more >
How To Generate PHPUnit Coverage Report In HTML and ...
A detailed guide by LambdaTest on how to generate a PHPUnit coverage report in HTML using Xdebug, PCOV, and php-code-coverage in HTML and ......
Read more >
The Problem With Code Coverage
This metric aims to measure number of lines covered by the test cases. It reports total number of lines in the code and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found