Reportgenerator: Cobertura xml as output format

Created on 3 Jun 2018  路  8Comments  路  Source: danielpalme/ReportGenerator

Is it possible to export report as Cobertura xml. So that i can use the report in VSTS/ TFS

I know that i can use a custom report. but i just want to know is it already implemented?

question

All 8 comments

No that is not supported.

Pleased have a look at https://github.com/danielpalme/OpenCoverToCoberturaConverter

Yes. I had a look on that. but I need to combine Cobertura and dotcover/opencover report using report generator which is currently possible. Then generated report i need to submit. so it seems i need to implement custom report or i have to build custom version of OpenCoverToCoberturaConverter

any other suggestion?

Both approaches will be quite hard to implement.
_OpenCoverToCoberturaConverter_ neither supports _DotCover_ nor does it support merging several input files.

_ReportGenerator_ does not provide enough information to generate a full Cobertura file.

Here is a sample Cobertura snippet:

<package name="test.sub" line-rate="0.0" branch-rate="1.0" complexity="1.0">
    <classes>
        <class name="test.sub.Sub" filename="test/sub/Sub.java" line-rate="0.0" branch-rate="1.0" complexity="1.0">
            <methods>
                <method name="&lt;init&gt;" signature="()V" line-rate="0.0" branch-rate="1.0" complexity="0">
                    <lines>
                        <line number="3" hits="0" branch="false"/>
                    </lines>
                </method>
                <method name="SampleFunction" signature="()V" line-rate="0.0" branch-rate="1.0" complexity="0">
                    <lines>
                        <line number="5" hits="0" branch="false"/>
                        <line number="9" hits="0" branch="false"/>
                    </lines>
                </method>
            </methods>
            <lines>
                <line number="3" hits="0" branch="false"/>
                <line number="5" hits="0" branch="false"/>
                <line number="9" hits="0" branch="false"/>
            </lines>
        </class>
    </classes>
</package>

ReportGenerator does not contain the information to create the <method> elements.

I was managed to overcome this using custom report

Can you share your code? Then I can add it to ReportGenerator, so everybody can use it.

The documentation states that Cobertura is one of the output formats. The usage page also includes Cobertura and will generate the following snippet "-reporttypes:Cobertura". When running with this as a report type I receive the error: "Unknown report type 'cobertura'."

@teeohdeedee
You have to use the latest pre release:
https://www.nuget.org/packages/ReportGenerator/4.0.0-rc4

Thanks! ..... and thanks for the very quick response!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotnetjunkie picture dotnetjunkie  路  3Comments

wsugarman picture wsugarman  路  4Comments

diegoibellini picture diegoibellini  路  7Comments

ahsonkhan picture ahsonkhan  路  3Comments

jpedretti-ciandt picture jpedretti-ciandt  路  3Comments