{code}
<profile>
<id>it</id>
<modules>
<module>model</module>
<module>common</module>
<module>business</module>
<module>eis</module>
<module>web</module>
</modules>
<build>
<pluginManagement>
<plugins>
<!-- ignore unit tests for now -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
{code}
In my web module where I have all my integration tests currently, I have set things up like this:
{code}
<profile>
<id>it</id>
<build>
<testResources>
...
</testResources>
<plugins>
<!-- ignore unit tests for now -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.plugin.version}</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<includes>
<include>**/*IT*</include>
</includes>
<argLine>${jacoco.agent.argLine}</argLine>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.3.201306030806</version>
<executions>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
<propertyName>jacoco.agent.argLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.plugin.version}</version>
<executions>
...
</executions>
<configuration>
...
<properties>
<cargo.servlet.port>9191</cargo.servlet.port>
<cargo.logging>high</cargo.logging>
<!--<cargo.jvmargs>${jacoco.agent.argLine}</cargo.jvmargs>-->
</properties>
<deployables>
...
</deployables>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
{code}
With the above settings, mvn completes successfully if I do a mvn clean verify -Pit, but when I look at my reports, I am getting zero percent coverage for the 188 integration tests that I have. If I uncomment the cargo.jvmargs, all my integration tests return 404 errors. What am I doing wrong?
Unfortunately they are not listed there. I assumed putting the argLine in the maven-failsafe-plugin would have used my IT tests for the code coverages. How do I make classes be used with the sessions???
Thank you for helping me!!!
Sharing the Love,
Jeff
So I put an includes with the package name like "com.company.*" in the jacoco-maven-plugin for the prepare-agent goal and now I'm seeing my test classes in the sessions tab, but I am still getting zero coverage in the coverage report. What else am I missing?
Many Thanks,
Jeff
So how would I make the classes used at runtime be the same classes that are used at report generation time?
Thank you so much for your time!!!
Sharing the Love,
Jeff
I posted a sample app that shows exactly what I am seeing. Is there any chance you can eyeball and let me know what I am doing wrong??? https://github.com/jeffwysong/coverage-multi-module
Thanks for your time.
Sharing the Love,
Jeff