Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.2
-
Fix Version/s: None
-
Labels:None
-
Environment:Windows XP, maven 2.0.8
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
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?
Issue Links
- is depended upon by
-
MCOBERTURA-138
Add support for configuring cobertura output directory and flag whether that directory should be used as build output directory
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | CoberturaIntegrationReportMojo.patch [ 41121 ] | |
| Attachment | CoberturaReportOnlyMojo.patch [ 41122 ] |
| Attachment | cobertura-maven-plugin_check-only-mojo.patch [ 43538 ] |
| Attachment | cobertura-maven-plugin_check-only-and-report-only-mojos_with-IT.patch [ 44369 ] |
| Patch Submitted | [Yes] | |
| Testcase included | yes |
| Comment |
[
Hi, I wanted to be able to run my integration tests with cobertura. I added the http://snapshots.repository.codehaus.org to the repository and did an mvn clean. It then downloaded the jars. I then ran mvn cobertura:cobertura-integration command but got an error that said the new mojo was not found. Pasted below is the our put of the mvn clean command that shouws the jars being downloaded. [INFO] [clean:clean {execution: default-clean}] [INFO] Deleting directory C:\Users\abc\workspace\restapi\target [INFO] [cobertura:clean {execution: default}] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Thu Apr 22 10:43:14 EDT 2010 [INFO] Final Memory: 9M/247M [INFO] ------------------------------------------------------------------------ C:\Users\abc\ workspace\restapi>mvn clean [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building restapi [INFO] task-segment: [clean] [INFO] ------------------------------------------------------------------------ [INFO] snapshot org.codehaus.mojo:cobertura-maven-plugin:2.3-SNAPSHOT: checking for updates from org.codehaus.mojo [INFO] snapshot org.codehaus.mojo:cobertura-maven-plugin:2.3-SNAPSHOT: checking for updates from nikhil Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/cobertur a-maven-plugin/2.3-SNAPSHOT/cobertura-maven-plugin-2.3-20090629.120157-3.pom 5K downloaded (cobertura-maven-plugin-2.3-20090629.120157-3.pom) Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/mojo/16/ mojo-16.pom [INFO] Unable to find resource 'org.codehaus.mojo:mojo:pom:16' in repository org .codehaus.mojo (http://snapshots.repository.codehaus.org) Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/mojo/16/mojo-16.pom Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/cobertur a-maven-plugin/2.3-SNAPSHOT/cobertura-maven-plugin-2.3-20090629.120157-3.jar 31K downloaded (cobertura-maven-plugin-2.3-20090629.120157-3.jar) Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/mojo-par ent/23/mojo-parent-23.pom [INFO] Unable to find resource 'org.codehaus.mojo:mojo-parent:pom:23' in reposit ory org.codehaus.mojo (http://snapshots.repository.codehaus.org) Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/mojo-parent/23/mojo -parent-23.pom [INFO] [clean:clean {execution: default-clean}] [INFO] Deleting directory C:\Users\abc\workspace\restapi\target [INFO] [cobertura:clean {execution: default}] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Thu Apr 22 10:44:23 EDT 2010 [INFO] Final Memory: 9M/247M [INFO] ------------------------------------------------------------------------ And here the mvn cobertura:cobertura-integration command being run C:\Users\abc\workspace\restapi>mvn cobertura:cobertura-integration [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Required goal not found: cobertura:cobertura-integration in org.codehaus. mojo:cobertura-maven-plugin:2.3-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: < 1 second [INFO] Finished at: Thu Apr 22 11:13:27 EDT 2010 [INFO] Final Memory: 3M/247M [INFO] ------------------------------------------------------------------------ C:\Users\nalmeida\limewire workspace\restapi> ] |
| Link | This issue is depended upon by MCOBERTURA-138 [ MCOBERTURA-138 ] |
| Assignee | Robert Scholte [ rfscholte ] |
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.