Cobertura Ant merge reports - ant

I need to merge coverage.xml reports generated by Cobertura. Cobertura creates reports in following structure:
./coberturaReports/module1/coverage.xml
./coberturaReports/module2/coverage.xml
I found bits and pieces from google, but I could still not make sense of it. Does anyone know how to merge these two Cobertura coverage.xml files into one?

Related

Is it possible to display Jacoco Coverage report on Jenkins dashboard?

I have jenkins file which has publishHTML method to generate report with .html file of jacoco result. Is it possible to display that report on dashboard like 'Test Trend Result' ?
So I went through a bit then found a solution adding to the pipeline directly
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
Reference: https://github.com/jenkinsci/code-coverage-api-plugin
You need to use the JaCoCo plugin
Get coverage data as part of your build First you need to get coverage
calculated as part of your build/tests, see the JaCoCo documentation
for details. You need at least one or more *.exec file available after
tests are executed. Usually this means adjusting your Maven pom.xml or
Ant build.xml file..
Set up coverage retrieval and publishing In order to get the coverage
data published to Jenkins, you need to add a JaCoCo publisher and
configure it so it will find all the necessary information. Use the
help provided via the question-mark links for more information.
Basically you specify where the *.exec files are, where compiled code
can be found and where the corresponding source code is located after
the build is finished to let the plugin gather all necessary pieces of
information..

Is it possible to show trends from an lcov report in jenkins?

I have an lcov report which produces a pretty html report and an lcov.info file. I want to see on jenkins whether our code coverage is improving or degrading. Is it possible to do this with an lcov report? I can do it using cobertura, but for various reasons we need to stick with lcov. We also need to see statements, branches, functions and lines.
The coverage report is being produced by istanbul/nyc.

Aggregate jmockit-coverage output with emma coverage output

Is there a way to aggregate code coverage data from jmockit-coverage and emma coverage? I can run the two different coverage steps in two separate junit ant tasks and generate the coverage data in two directories. Just not sure if the coverage outputs from these two are compatible and can be merged to display together.
No, they can't be aggregated into a single HTML report, since these are two different code coverage tools, which know nothing about each other. Of course, someone could create yet another tool which would do that; personally, I don't see much value in it, though.

Using gcovr to show zero coverage

we try to use gcovr to generate coverage report for our c++ project in Jenkins.
I was able to get it worked, but I'm stuck with one problem. gcovr doesn't show any statistics for files with zero coverage - they have only .gcno files, no .gcda files are produced and gcovr don't show it in results.
So I have 80% coverage for the whole project, but only 2 tests were written and it's actually 80% coverage only for source files involved in tests.
For large project it makes of course no sense to use such statistic.
I have found https://software.sandia.gov/trac/fast/changeset/2766 this changeset as solution for this ticket https://software.sandia.gov/trac/fast/ticket/3887, but it seems not to be working.
Did I miss something?
p.s. I use gcovr 3.1-prerelease

Combine cobertura code coverage reports of three separate projects

I have three projects which are stored in three separate repositories. Each of them is a individual mvn project. I wonder is there a way to aggregate three reports in one?
I took a look at the cobertura aggregate function. But seems like it can only handle sub-modules of a project.
Anybody has any suggestion?
The Maven plugin goal cobertura:cobertura supports an aggregate parameter that would work for all the projects in the reactor I suppose.
But you seem to suggest the projects might not be in the same structure/reactor, and i wouldn't know how to do it with maven per-se. However, you can easily do it with a little ant script that can be integrated in your maven structure.
The Cobertura Ant library has a merge task that can merge a number of .ser files (generated by the runtime execution of your instrumented code). This will generate a combined .ser file for which you can generate a xml or html report from.
Let me know if you need more pointers.
In another question a responder gave a link to a python script they had written that did what you are asking, I moved that "xml combiner" to a gist that is located here

Resources