Generate two coverage reports in a single jenkins build
Asked Answered
E

2

11

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?

Exclaim answered 7/10, 2014 at 8:17 Comment(6)
how about karma-coverage? It supports multiple reports. github.com/karma-runner/karma-coverage#multiple-reportersHaustellum
I already use karma-coverage to create report. But my problem is that in jenkins I don't know how to generate a second coverage report in a build.Exclaim
I don't get why you can't generate multiple reports in jenkins. Can you generate multiple reports in your local terminal?Haustellum
because when I edit my jenkins build, once I create a coverage report (used for java part) I can't add another coverage report. The 'publish cobertura coverage report' menu is disabled (I used code coverageReporter : { type : 'cobertura', dir : '../target/karma-coverage/' } code in my karma configuration file)Exclaim
Did you solve your problem? Currently I want to do the same thing, show two coverage for python test and karma in Jenkins.Quinte
No sorry, I unfortunately had to create another build. If you find a solution, share it please !Exclaim
M
1

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.

Massacre answered 20/3, 2018 at 16:8 Comment(0)
H
0

If I'm right, you can't use, as a post build action, the same plug-in twice( note that I'm not really sure). I faced this problem when I worked as Jenkins plug-in developer for a company and the solution was to use a plug-in that make the same thing.

For example: for JUnit reports there is an official JUnit plugin and also XUnit. For my problem it was simple.

So, maybe you can find a plug-in that do the same thing as Cobertura or you can change the output format of the java coverage or karma coverage. For example, for java you can use EclEmma or Jacoco...

Himyarite answered 25/12, 2014 at 10:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.