Reputation: 4121
I am just looking at the cobertura maven plugin and I wasnt sure if the following is possible
I have a multi module maven project and the coverage of the domain module is showing up as 0% even though its been used by every other module I have tried different combinations of things but the coverage of my domain module always stays at 0%. People have mentioned writing separate tests for the domain classes but i dont want to do this as you could easily write a tests to test a function that isn't actually being used anywhere within the codebase
Any pointers would be greatly appreciated
Upvotes: 2
Views: 482
Reputation: 8648
For multi-module maven projects cross-module coverage seems not to be available off-the-shelf with Cobertura.
A solution using a mixture of maven and ant is described byThomas Sundberg: http://thomassundberg.wordpress.com/2012/02/18/test-coverage-in-a-multi-module-maven-project/
See also this related question: Maven2 Multiproject Cobertura Reporting Problems During mvn site Build
Upvotes: 0
Reputation: 10833
In order to do so you would have to execute the maven goals in the correct order so :
cobertura:instrument
test
goalToAskCoberturaToGenerateReport
But then comes the trouble : there is no such goal as cobertura:report, if you look at the documentation and source code of the maven plugin : The goal cobertura:cobertura is the only goal generating the report. I suspect it is as such because of some maven internal limitation.
So in short, given the state of the maven plugin it is not possible.
You might have a chance to manage what you want to achieve by executing cobertura from the command line.
Upvotes: 1