OpenCppCoverage can easily create code coverage report for Jenkins using Cobertura plugin.

Cobertura plugin

First, install Cobertura plugin if it is not already done.

You can go to where is your server name, search for Cobertura plugin and install the plugin.

You must restart Jenkins.

Run your tests

In your Jenkins project, click on Add build step and then select Execute Windows batch command.

Your tests should be run with OpenCppCoverage and --export_type=cobertura.
This flag will create a xml file named XXXCoverage.xml where XXX is the name of your program.


In the previous example, YourTest.exe is the test to run. You need to use the full path (on Jenkins machine) for OpenCppCoverage.exe or add it in the environment variable PATH. The file YourTestCoverage.xml will be created by the previous command.

Post-build Actions

The last step is to add a Post-build Actions to your project and select Publish Cobertura Coverage Report.
In the field Cobertura xml report pattern, you must enter the location of your coverage file. Note that this location is relative to your workspace folder.


You can use *Coverage.xml if you have several tests for example.
See Cobertura plugin for more information.

View Coverage

Here are some outputs. Note that the Conditionals coverage is not supported.



Last edited Aug 23, 2014 at 1:32 PM by OpenCppCoverage, version 2