1

I have a multimodule maven project with modules such as: moduleA, moduleB, moduleC. Then I have an entirely separate moduleTest that has integration tests in it run by the failsafe plugin.

I want to have a report generated by cobertura(or any other maven plugin) that can tell me which lines in all of moduleA, B and C are covered by my integration tests.

I don't think http://jira.codehaus.org/browse/MCOBERTURA-65 helps me. Is there an easy way to achieve this?

SamSam
  • 11
  • 2
  • 1
    +1 Also looking for the same setup. I have been trying to achieve this same thing using Jacoco and I came across http://www.lordofthejars.com/2012/07/jacoco-in-maven-multi-module-projects.html and a few others that do something similar to what you have in your link. Have you found anything new? – Tash Pemhiwa Sep 12 '14 at 10:16

1 Answers1

1

One of possible solutions is to use Emma. You shall setup code instrumentation in your source code modules by using instrument goal:

http://mojo.codehaus.org/emma-maven-plugin/instrument-mojo.html

After successful compilation and instrumentation, tests execution will generate coverage data. Then You can execute emma standalone tool to generate report based on it:

java emma report -r txt,xml,html -in coverageA.em,coverageB.em,coverageC.em,coverage.ec -sp srcA/,srcB,srcC

coverage*.em shall be replaced with proper paths to generated by Emma metadata in source code modules, coverage.ec is path to coverage file generated in test module, src* directories shall be replaced with paths to source code directories. Here is detailed documentation:

http://emma.sourceforge.net/reference/ch02s04s03.html

You can do it also with jacoco (also in a quite tricky way) but due too low reputation I cannot put more than 2 links. So like it like it! :)

Piotr Oktaba
  • 775
  • 1
  • 4
  • 14
  • Here is a question which can also help you a little bit: http://stackoverflow.com/questions/26084729/feed-sonarqube-jacoco-widget-with-csv-html-reports-instead-of-exec/ . And link to tricky way to generate report without Sonar: http://intellectualcramps.wordpress.com/2012/03/22/jacoco-tycho-and-coverage-reports/ – Piotr Oktaba Sep 28 '14 at 14:01