Hello,


I'm currently working on a multi-module maven project where we had some 
integration tests running as regular unit tests (using surefire). This resulted 
in a code coverage of about 10%.

After migrating the integration test (renaming them to *IT.java and executing 
them using failsafe) I noticed that the integration test coverage rose to 16% 
and my unit test coverage lowered to 9%.

I did read somewhere that jacoco doesn't support cross-module coverage, but it 
seems like it does support it when running the tests as integration tests. 

Is this behavior the be expected or should I be looking into a configuration 
issue ?


The maven plugins are configured as follows:

<sonar.jacoco.reportPath>${project.basedir}/target/jacoco-unit.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <argLine>${argLine} -Xms512m -Xmx1024m -XX:MaxPermSize=386m</argLine>
    </configuration>
    <!-- <configuration> -->
    <!-- <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=386m</argLine> -->
    <!-- </configuration> -->
</plugin>
<plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-failsafe-plugin</artifactId>
       <configuration>
            <argLine>${failsafe.argLine} -Xms512m -Xmx1024m 
-XX:MaxPermSize=386m</argLine>
       </configuration>
       <executions>
           <execution>
               <id>integration-test</id>
               <goals>
                   <goal>integration-test</goal>
               </goals>
           </execution>
           <execution>
               <id>verify</id>
               <goals>
                   <goal>verify</goal>
               </goals>
           </execution>
       </executions>
</plugin>

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>pre-unit-test</id>
            <configuration>
                <destFile>${sonar.jacoco.reportPath}</destFile>
            </configuration>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>post-unit-test</id>
             <configuration>
                               <dataFile>${sonar.jacoco.reportPath}</dataFile>
                           </configuration>
            <phase>test</phase>
            <goals>
                <goal>report</goal>
            </goals>
        </execution>
        <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
            <configuration>
                <destFile>${project.basedir}/../target/jacoco-it.exec</destFile>
                <propertyName>failsafe.argLine</propertyName>
            </configuration>
        </execution>
        <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>report</goal>
            </goals>
            <configuration>
                <dataFile>target/jacoco-it.exec</dataFile>
            </configuration>
        </execution>
    </executions>
</plugin>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to