danielpalme / ReportGenerator

ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.

Home Page:https://reportgenerator.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reportgenerator generated html and xml file is mismatched with its input Cobertura xml file

waseemkhan1989 opened this issue · comments

commented

Describe the bug
I am using squish coco as code coverage tool to generate report in .csmes format (it is a squish coco format). To generate a Cobertura xml format report, I am using following instruction provided by squish coco:

/opt/coco-5.0.3/bin/cmreport --coverage-mcdc --csmes=./coverage_report.csmes --cobertura=Coverage.xml --cobertura-azure-devops --cobertura-source=.

It generates Coverage.xml report. After that, I use ReportGenerator as task on my Azure pipeline to convert Coverage.xml into html file:

- task: reportgenerator@5 displayName: ReportGenerator inputs: reports: $Path/to/build-Directory/coverage/Coverage.xml targetdir: $Path/to/build-Directory/coverage/Cobertura-html-report reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges' assemblyfilters: '-xunit*'

It generates the Cobertura.xml file and html files including index.html file. As I want to publish the coverage report on Azure dashboard, I use the following task:

  • task: PublishCodeCoverageResults@1
    inputs:
    codeCoverageTool: "Cobertura"
    summaryFileLocation: $Path/to/build-Directory/coverage/Cobertura.xml
    failIfCoverageEmpty: true
    displayName: "Publish Code Coverage results"

    I already declare the following variable so that PublishCodeCoverageResults@1 do not generate its own html report.
    env: DISABLE_COVERAGE_AUTOGENERATE: 'true'

The problem is, the Cobertura.xml report generated by ReportGenerator has different values for line and branch coverage from the original Coverage.xml report which is input to Report Generator. The Cobertura.xml and its corresponding generated html file has same values.

Why Cobertura.xml has different values for branch and coverage? Should it not only convert the Cobertura Coverage.xml file into html without changing any statistics?

P:S: I extensively search this problem but could not find a satisfactory answer.

@waseemkhan1989
If you already have a Cobertura file, there is no need to let ReportGenerator produce the file again.
You should be able to pass the original Cobertura file to PublishCodeCoverageResults.

As ReportGenerator supports a lot of coverage format, the Cobertura output format may differ from the original input file.
If you like, you can send me your Cobertura file and I will see if I can improve the one generated by ReportGenerator.
You can share the file privately via email: reportgenerator@palmmedia.de

commented

@danielpalme
Plz check the email.

I will have a look within the next days.

I just answered your email.
For me the metrics calculated by Squish are not correct. See my email for a concrete example.