Skip to content

Transforms multiple code coverage formats to Cobertura. With CLI tool and NUKE build integration.

License

Notifications You must be signed in to change notification settings

GeorgDangl/CoberturaConverter

Repository files navigation

CoberturaConverter

Build Status
Built with Nuke
NuGet MyGet

Changelog
Documentation

This package aims to provide conversion of code coverage reports to the Cobertura format. Currently, it supports OpenCover and dotCover source formats. It can be either directly used via the CoberturaConverter NuGet package, as Dangl.Nuke.CoberturaConverter for the NUKE Build system or as command line tool via CoberturaConverter.CommandLine.

This project is based on Daniel Palmes OpenCoverToCobertura Converter, which is licensed under the Apache License.

dotCover Report Types

Because the filename attribute is mandatory in the Cobertura format, dotCover reports should always be generated with the DetailedXml setting instead of the regular Xml to output filenames. Otherwise, all classes in the dotCover report that do not have a source file specified are ignored.

Referencing

If this is used in full .Net framework 4.6.1 and earlier, please add a reference to

<PackageReference Include="System.ValueTuple" Version="4.4.0" />

CI Builds

All builds are available on MyGet:

https://www.myget.org/F/dangl/api/v2
https://www.myget.org/F/dangl/api/v3/index.json

CLI Usage

You can use the converter from the command line, it is available in the CoberturaConverter.CommandLine NuGet package under /tools both for net461 and netcoreapp2.0.

CoberturaConverter.CommandLine.exe -i <InputFile> -o <OutputFile> -s <DotCover | OpenCover>
Parameter Description
-i Path to the input file
-o Path where to save the converted report to
-s Source report format, can be either DotCover or OpenCover
--help Display options

NUKE Example

The package is available as Dangl.Nuke.CoberturaConverter.

using static Nuke.CoberturaConverter.CoberturaConverterTasks;

await DotCoverToCobertura(s => s
    .SetInputFile(OutputDirectory / "coverage.xml")
    .SetOutputFile(OutputDirectory / "cobertura_coverage.xml"));

License