This project has moved and is read-only. For the latest updates, please go here.

Cobertura-compatible XML output format for Jenkins integration

Oct 10, 2012 at 10:54 AM


I'm looking to integrate OpenCover into a Jenkins-driven .NET build. I currently have configured the html reports to be merged into the output, but Jenkins offers much tighter integration for tools producing a Cobertura format coverage file. Did anyone perhaps look into adding this output format support to ReportGenerator?




Oct 10, 2012 at 11:22 AM

Can you provide me a sample report in the desired Cobertura format?

Then I can have a look and decide whether it is possible to generate such a report.

Oct 10, 2012 at 2:51 PM

cobertura.xml from Cobertura own test drive (failed unit tests for some reason, but file should be a good enough sample): (skydrive, permanent link).

Syntax itself comes from and there's a DTD available as well (linked from XML header).

Oct 10, 2012 at 8:08 PM

I will have a look at the format within the next days and then I will decide what I can do about it.

Oct 19, 2012 at 11:28 AM

I just took a closer look at the cobertura report you provided.

It is not possible to generate this report format with ReportGenerator. ReportGenerator uses the coverage report to collect assemblies, classes and the corresponding files. Then it reads the files and generates a report with the coverage of each line.

The Cobertura report is similar to an OpenCover report. It has the same structure. So it could be possible to write a converter. When I find time, I will try to do this and let you know about it.

Oct 20, 2012 at 10:59 PM

I created a tool that does the conversion:

Let me know if this works for you, or if you have any issues.

Oct 20, 2012 at 11:05 PM

You're amazing! (and I feel bad for not writing this myself) I'll have a go at it on Monday, will post back how well it worked (we have quite a large codebase, 550k LOC).

Aug 27, 2013 at 5:51 AM
Hi Daniel,

I am planning to use the Cobertura plugin in Jenkins to see coverage trends, right now I am using Reportgenerator to generate html type reports from open cover coverage results. I would like to know whether Report generator supports a way to merge the open cover results of multiple sessions into a single consolidated xml so that I can provide that as an input to OpenCoverToCoberturaConverter.

Aug 27, 2013 at 8:23 AM
Hi Charles,

ReportGenerator is able to use several OpenCover files as input. But it does not merge those reports into one big OpenCover XML.
Instead it generates one HTML report based on all input files.

But it should be doable to extend OpenCoverToCoberturaConverter to support several input files.
Aug 27, 2013 at 9:06 AM
Hi Charles,

generally, merging is not necessary, because Jenkins can deal with multiple input (Cobertura-formatted) files and merge them itself.
Feb 7, 2014 at 8:05 AM

First of all, let me thank you for the great work - now I'm finally able to see code coverage within Jenkins!

However, there seems to be an issue with the OpenCoverToCoberturaConverter - seems like conditionals are not handled correctly - within Jenkins code coverage report all conditionals are displayed as N/A and conditionals coverage is 100%.

If I refer to html report generated by ReportGenerator I can see the right values for branch coverage.

Please let me know if you need more info.

Feb 7, 2014 at 10:39 AM
Hi Boris,

I'm sorry, but without any details I can only guess what OpenCoverToCoberturaConverter does wrong.
OpenCoverToCoberturaConverter is not perfect, I remember that that there were some edge cases which can't be supported (due to missing information in the Coberture report).
But if you can provide a concrete (minimal) sample report and the corresponding source code, I can have a look at the problem.
Some explanations/screenshots showing what's wrong would help too.
Or even better: You can try to fix it yourself and then send me a pull request for OpenCoverToCoberturaConverter.

Cheers, Daniel
Feb 9, 2014 at 8:34 PM
Just took a quick look at the code and I believe that the OpenCoverToCoberturaConverter is not producing <conditions> tags, i.e.:
<line number="23" hits="9" branch="true" condition-coverage="50% (1/2)">
    <condition number="0" type="jump" coverage="50%"/>
above sample was taken from

OpenCoverToCoberturaConverter always produces branch="false" and no conditions (at least the version on Git).

I did try to modify the code, but was confused by the following:
<Method visited="true" cyclomaticComplexity="2" sequenceCoverage="100" branchCoverage="66.67" isConstructor="false" isStatic="false" isGetter="false" isSetter="false">
  <Summary numSequencePoints="6" visitedSequencePoints="6" numBranchPoints="3" visitedBranchPoints="2" sequenceCoverage="100" branchCoverage="66.67" maxCyclomaticComplexity="2" minCyclomaticComplexity="2" />
  <Name>System.Void SomeClass::Dispose()</Name>
  <FileRef uid="20" />
    <SequencePoint vc="3" uspid="437" ordinal="0" offset="0" sl="21" sc="9" el="21" ec="10" />
    <SequencePoint vc="3" uspid="438" ordinal="1" offset="1" sl="22" sc="13" el="22" ec="51" />
    <SequencePoint vc="3" uspid="439" ordinal="2" offset="13" sl="23" sc="13" el="23" ec="36" />
    <SequencePoint vc="3" uspid="440" ordinal="3" offset="21" sl="24" sc="17" el="24" ec="38" />
    <SequencePoint vc="3" uspid="441" ordinal="4" offset="28" sl="26" sc="13" el="26" ec="26" />
    <SequencePoint vc="3" uspid="442" ordinal="5" offset="35" sl="27" sc="9" el="27" ec="10" />
    <BranchPoint vc="3" uspid="443" ordinal="0" offset="19" path="0" />
    <BranchPoint vc="0" uspid="444" ordinal="1" offset="19" path="1" />
  <MethodPoint xsi:type="SequencePoint" vc="3" uspid="437" ordinal="0" offset="0" sl="21" sc="9" el="21" ec="10" />
public void Dispose()
  var disposable = value as IDisposable;
  if (disposable != null)  // line number 23

  value = null;
How can one know that
    <BranchPoint vc="3" uspid="443" ordinal="0" offset="19" path="0" />
    <BranchPoint vc="0" uspid="444" ordinal="1" offset="19" path="1" />
refer to line 23?

Please note I'm a total noob, I only wanted to see code coverage in Jenkins :)

Feb 10, 2014 at 1:03 PM
Hi Boris,

there is no way to know which BranchPoint corresponds to which line.
This is the reason why OpenCoverToCoberturaConverter is not producing <conditions> tags.

Cheers, Daniel
Apr 24, 2014 at 12:22 AM
This converter is a great tool to have - thanks Daniel!

Would you consider making it available as a tool within NuGet, in the same way as the main ReportGenerator?
Apr 24, 2014 at 3:28 PM
Apr 24, 2014 at 10:19 PM
Excellent! Thanks Daniel :)
Sep 1, 2014 at 10:34 AM

Can you please brief the steps for integration with Jenkins. Like Which plugin are you using... ?? or VS settings to generate open cover reports etc.

Currently I am using Command line for Open Cover and Generating Xml file and
then in next command line calling ReportGenerator exe. and then publishing it.

How OpenCoverToCoberturaConverter plugin make this task easier ??

Arpit Nagar
Oct 1, 2014 at 5:21 PM
Edited Oct 2, 2014 at 6:00 PM
@danielpalme, @crnjan - I contacted the developer of OpenCover and there is a release that adds the line number (sl) in the branch points. Here is the reply.
molnagab did work on just that and as I understand it, it us also supported by ReportGenerator.
    <BranchPoint vc="0" uspid="84" ordinal="0" offset="34" sl="17" path="0" offsetchain="" offsetend="36" />

I sent a pull request with my changes that inserts the branch coverage on each class and method lines that contains a branch=true.
<line number="13" hits="3" branch="true" condition-coverage="50% (1/2)" />
Jun 19, 2015 at 8:56 AM
danielpalme wrote:
Can you provide me a sample report in the desired Cobertura format? Then I can have a look and decide whether it is possible to generate such a report.
How can I convert from html report to cobertura.xml report format ? Because I wanted code coverage reports in Jenkins and I have a report that is html format.
Jun 19, 2015 at 8:27 PM
Sorry. Thats mit possible. It should be possible to integrale the HTML report into Jenkins
Jun 22, 2015 at 8:35 AM
danielpalme wrote:
Sorry. Thats mit possible. It should be possible to integrale the HTML report into Jenkins
But I want to see this raport in jenkins with graphical form ?(by using percentage in the report)
Jun 22, 2015 at 12:26 PM
I'm sorry, but I don't understand what you want to achieve.

You can convert an OpenCover XML to Cobertura with this tool:
Jul 22, 2015 at 12:15 PM
I can't access remote locations from Jenkins, while it works OK in Windows cmd. I am giving the access denied error. Can you help me?