I am using cobertura plugin in jenkins for code coverage. I want to change value of name column in Project Coverage summary on a per-report basis.
Is there any way to change this. I want to give my project name over there.
Simply put, Cobertura is a reporting tool that calculates test coverage for a codebase – the percentage of branches/lines accessed by unit tests in a Java project.
1. Cobertura Code Coverage Report. Do nothing, just type the following Maven command to download and run the maven-cobertura-plugin automatically. Maven will generate the Cobertura code coverage report at ${project}/target/site/cobertura/index.
Here is a fork of the plugin that does what you are asking (project name instead of "cobertura coverage report").
https://github.com/andytompkins/cobertura-plugin
Right now it just uses the project name. I suppose this could become a configurable item? I'll be glad to work on it more if something else is needed, and could probably even package the changes up in a way that upstream will take them.
The relevant code that was changed was in CoverageResult.java. Added a method:
public String getJobName() {
AbstractProject job = owner.getProject();
return job.getName();
}
And in the index.jelly changed the reference from it.name to it.getJobName().
<td>${it.getJobName()}</td>
It will be a bit harder to make it on a per-report basis. The report itself does not have a name or title field - and this plugin does not control the format, it just reads it.
I too am using this with a javascript project that uses karma and karma-coverage. Currently running the forked plugin in production jenkins.
EDIT: In the branch use-filename-for-reportname in my repo you will find a version of the plugin that will use the coverage file's name as the report name.
I suggest going to the plugin page, contacting one of the maintainers:
Stephen Connolly (id: stephenconnolly)
Manuel Carrasco Monino (id: manuel_carrasco)
Seiji Sogabe (id: ssogabe)
And asking them how you can do it.
Once you have the solution, share it here, because others (like me) might also want this capability...
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With