5

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?

joewhitedelux
  • 169
  • 1
  • 2
  • 9
  • In my case https://gcovr.com/en/stable/guide/merging.html (i.e. generating to json files then merging using the --add-tracefile option) did the trick. – Roland Sarrazin Jun 29 '22 at 17:37

2 Answers2

1

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.

Patrice M.
  • 4,209
  • 2
  • 27
  • 36
  • Some of the projects are mvn project and some of them are ant project. I'm only interested in the overall code coverage results across all projects. I'm trying to write a little parser to parse the results in coverage.xml files. Would you know is there a tool can help me doing this? – joewhitedelux Nov 08 '13 at 09:24
  • I don't. But again, normally you get the coverage.xml files from generating the report from the raw .ser file. Cobertura provides the command to accurately merge the .ser files, and then you can generate your xml (or html) report. So in short, you're better off merging the .ser files first and then generate an aggregate .xml report, rather than trying to merge the .xml reports. That is the cobertura model at least. – Patrice M. Nov 09 '13 at 03:00
1

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

Community
  • 1
  • 1
Tim Overly
  • 425
  • 4
  • 10