JaCoCo maven-plugin and JaCoCo Agent

319 views
Skip to first unread message

Frank Krumm

unread,
Feb 13, 2015, 7:19:53 AM2/13/15
to jac...@googlegroups.com
Hi,

I want to check code coverage on external weblogic.

I have a Windows Computer with Eclipse and Maven and a oracle linux with weblogic in oracle virtual pc.

I already installed the JaCoCo Agent on the linux box and it is running inside weblogic.

When I get the measured data form the weblogic in the vbox with the jacoco:dump goal, the corresponding .exec file fills with data.
But: there is no code coverage for the integration tests.

If I run the tests in Eclipse and import data from tcpserver with Import Code Coverage, there is code coverage shown.

I don't understand, what runs wrong in maven-plugin, because as I see no difference in information between Eclipse and maven.

Any suggestions?

Code hier eingeben...                   <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when Maven the Surefire plugin is executed.         -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
<!-- <goal>instrument</goal> -->
</goals>
<configuration>
<propertyName>surefireArgLine</propertyName>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
<include>**</include>
</configuration>
</execution>
<!-- Ensures that the code coverage report for unit tests is created after unit tests have been run.         -->
<execution>
<id>post-unit-test</id>
<phase>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-ut.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
<output>file</output>
<!-- Sets the name of the property containing the settings for JaCoCo runtime agent.                 -->
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<!-- Ensures that the code coverage report for integration tests after integration tests have been run.         -->
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>dump</goal>
   <goal>report-integration</goal>
</goals>
<configuration>
<address>vbox</address>
<exclude>com.*</exclude>
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
<!-- 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>


and failsafe plugin:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/integration/**</include>
<include>**/ws/**</include>
<include>**/gui/**</include>
</includes>
<!-- Sets the VM argument line used when integration tests are run. -->
<!-- Sets the VM argument line used when integration tests are run. -->
<argLine>${failsafeArgLine}</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>


Any hints are welcome how to solve this issue in maven. I'd like to show the jacoco results in sonarqube once the problem with the maven plugin is solved.

bye

frank

Marc Hoffmann

unread,
Feb 17, 2015, 12:12:42 PM2/17/15
to jac...@googlegroups.com
Hi,

where do the deployed classes from the interation tests do come from?
Note that the class files under tests must be the exact same class file
than the class files used at report generation time.

If you can import the exec file successfully to Eclipse this means the
classes under test are from your Eclipse workspace. Maybe within the
Maven build you use different class files (compiled with javac and not
Eclipse).

Regards,
-marc
> --
> 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 jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/8d264d17-9bee-4eea-87cc-ecbfba39ae47%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/8d264d17-9bee-4eea-87cc-ecbfba39ae47%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages