Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate two coverage reports in a single jenkins build

I have a Jenkins build which build all my java/angularJS project. It launch testNG tests for the java part and karma tests for the javascript part. So I can generate one testNG report (for java) and one junit report (for karma test) in my Jenkins build. This is working very well.

Until now, I used cobertura to report the coverage of my java tests. But now I would like to add also a coverage report for my karma tests (generated by Istanbul with cobertura type). The problem is that, in Jenkins, I'm allowed to generate only one coverage report in a build (I can't add more that one 'publish cobertura coverage report' post build action). So how can I have these two coverage reports in a single Jenkins build?

like image 895
clement Avatar asked Oct 07 '14 08:10

clement


People also ask

Which plugin is used to generate report for code coverage in Jenkins?

This plugin allows you to capture code coverage report from Cobertura. Jenkins will generate the trend report of coverage. The Cobertura plugin can be downloaded here.

How does Jenkins read code coverage report?

If you click on the Coverage Report icon, you will see code coverage for each package in your application, and even drill down to see the code coverage (or lack thereof) for an individual class (see Figure 2.31, “Jenkins lets you display code coverage metrics for packages and classes”).


1 Answers

There's a nice plugin called HTML Publisher Plugin. You can generate HTML coverage reports and publish as much reports as you want under different titles in one Jenkins project. For example I generate html reports using karma+istanbul and then publish them to Jenkins.

On JUnit xml report files. You should import JUnit once enumerating all files probably from different directories but you can differentiate them with proper package names inside files.

like image 161
norekhov Avatar answered Sep 28 '22 12:09

norekhov