-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Mismatch between Branch Coverage in Cobertura and HTML reports #393
Comments
Here's how we're combining the coverage files from 3 different test runs:
|
The HTML and the Cobertura file generated by ReportGenerator should be consistent. You are using the "PublishCodeCoverageResults" task: - task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage' This task uses the Coberatura file generated by ReportGenerator, but it does not use the HTML output of ReportGenerator. disable.coverage.autogenerate: 'true' See also: https://github.com/danielpalme/ReportGenerator/wiki/Integration#attention Does this fix your problem? It might be helpful to pack the output of ReportGenerator (directory $(Build.SourcesDirectory)/CodeCoverage) into an artifact which you can download. Then you can inspect the HTML and Cobertura files directly. |
We are not using
You're saying if we add it, we should see consistency between the HTML and cobertura.xml files? I have already downloaded the CodeCoverage artifact and determined that the HTML and cobertura.xml files in there do not match currently. |
At least the HTML files won't get regenerated, which might cause additional inconsistencies.
Can you share the three Cobertura files that you are passing to ReportGenerator? |
Can you share the cobertura xml files? |
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. |
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 |
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:
MicrosoftPremier/VstsExtensions#120
Thanks!
The text was updated successfully, but these errors were encountered: