Hi,
I have written a simple Java Web Service and have deployed it onto Glassfish. 
I have created a separate test project that calls the web service end points 
that are in the dev project. 

Here are the relevant snippets from the two POM files:

Dev: +++++++++++++++
 <execution>
   <id>pre-integration-test</id>
   <phase>pre-integration-test</phase>
   <goals>
      <goal>prepare-agent</goal>
   </goals>
   <configuration>
      
<destFile>${project.build.directory}/coverage-reports-it/jacoco-it.exec</destFile>
      <propertyName>failsafeArgLine</propertyName>
   </configuration>
</execution>



Started Glassfish with the following JVM option :
-DargLine=-javaagent:C:/iat/mavenrepository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=C:/mySampleApp/target/coverage-reports-it/jacoco-it.exec



Test POM: ++++++++++++++++++++++++++++++
<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.9</version>
    <executions>
        <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>report</goal>
            </goals>
            <configuration>
                
<dataFile>C:/mySampleApp/target/coverage-reports-it/jacoco-it.exec</dataFile>
                
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.20.1</version>
    <configuration>
        
<argLine>-javaagent:c:\\iat\\mavenrepository\\org\\jacoco\\org.jacoco.agent\\0.7.9\\org.jacoco.agent-0.7.9-runtime.jar=destfile=C:\\mySampleApp\\target\\coverage-reports-it\\jacoco-it.exec</argLine>
    </configuration>
    <executions>
        <execution>
            <id>integration-tests</id>
            <phase>verify</phase>
            <goals>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>






When I run mvn verify goal, it seems to be analyzing the files in the Test 
Maven project (and not the Dev project). Here is what I am seeing when I run 
the goal, can someone suggest what I am missing::


[INFO] Analyzed bundle 'JaxRsAppTest' with 3 classes
[WARNING] Classes in bundle 'mySampleAppTest' do no match with execution data. 
For report generation the same class files must be used as at runtime.
[WARNING] Execution data for class com/test/ServiceIntegrationTest does not 
match.
[WARNING] Execution data for class com/util/Common does not match.
[WARNING] Execution data for class com/util/RestClient does not match.

My goal is to analyze coverage for the Dev project. 
Please note that I am able to see the expected coverage when the Dev project 
has both Unit and Integration tests. But my goal is to measure integration test 
coverage from a separate test project.

Thanks in advance.

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/c2934d90-228e-4b5e-ba57-c71328552318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to