Description

In my project, I have both unit tests ("test" phase) and integration tests ("integration-test" phase).
So far I could manage configuring maven-surefire-plugin and maven-surefire-report-plugin to execute both tests correctly and also generate 2 different reports.
Then I have added cobertura-maven-plugin to the reporting in order to get coverage but unfortunately only unit tests have their coverage reported (I know it because I have some classes which are only integration tested but are reported as 0% covered).
After trying to find information on the mailing lists, on the web and other existing resources, I could not find any hint on how to make this work.
It looks like cobertura-maven-plugin, by its current design, will never run integration-test to collect coverage, it seems to stop at the "test" phase.

Thus whenever a POM project has integration tests and uses cobertura-maven-plugin for coverage report, the generated reports are wrong, which is very misleading.

Actually, I was surprised not to find this issue already in JIRA.

Is there a chance this gets fixed soon? Or is there a usable workaround for this problem (besides switching to clover which I am not sure it would work better ) Did someone succeed in patching cobertura-maven-plugin to get the correct behavior?

Activity

The documentation for cobertura:cobertura flat out says that it runs the "test" phase prior to executing itself, so I assume this currently cannot be configured. There's of course much more complicated cases that people use the integration-test phase for, but for a lot of projects, it'd be enough if you could configure Cobertura to at least include or run integration-test phase instead. Email thread at http://www.mail-archive.com/users@maven.apache.org/msg78743.html.

Kalle Korhonen
added a comment - 10/Mar/08 2:36 PM The documentation for cobertura:cobertura flat out says that it runs the "test" phase prior to executing itself, so I assume this currently cannot be configured. There's of course much more complicated cases that people use the integration-test phase for, but for a lot of projects, it'd be enough if you could configure Cobertura to at least include or run integration-test phase instead. Email thread at http://www.mail-archive.com/users@maven.apache.org/msg78743.html .

Dennis Lundberg
added a comment - 06/Nov/14 8:25 AM Digging some more into the code it looks like we will also need a CoberturaIntegrationTestCheckMojo that extends the CoberturaCheckMojo , but with a different execution phase.
The clean , dump-datafile and instrument goals does not appear to require any changes.

Dennis Lundberg
added a comment - 06/Nov/14 9:09 AM Two new goals were added in r20181:
cobertura-integration-test (based on the patch by Stevo Slavic)
check-integration-test
They extend the cobertura and check goals, but change the execution phase so that integration tests are also included in the Cobertura analysis.
I will push new SNAPSHOTs to the snapshot repo a little later, so that people can test it out.