JaCoCo Maven plugin and test plugins

1,312 views
Skip to first unread message

Dezider Mesko

unread,
Apr 18, 2013, 6:09:31 AM4/18/13
to jac...@googlegroups.com

Hi all,

I would like to ask, how exactly JaCoCo maven plugin works.

I have another plugin in integration test phase, and I would like to include its execution to code coverage. 

For online instrumentation I don't see any configuration in example pom file. How JaCoCo knows when to instrument? Or even better how to force JaCoCo to instrument even during integration-test phase. (for unit tests data are generated fine, for integration tests not)



Thank you!

d.

Mirko Friedenhagen

unread,
Apr 18, 2013, 7:10:45 AM4/18/13
to jac...@googlegroups.com

Hello Dezider,

jacoco-maven-plugin just sets a property argLine, which is automatically picked up by surefire and failsafe unless you did reconfigure this property yourself in your pom.
Then you set this in surefire:

<argLine>${argLine} -Xmx512m</argLine>

Note when you set jacoco.skip=true, the plugin will return an empty string, so this should not break anything.

Regards Mirko
--
Sent from my mobile

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dezider Mesko

unread,
Apr 18, 2013, 8:29:26 AM4/18/13
to jac...@googlegroups.com
I see,
my issue is that I'm using robotframework plugin (not surefire/failsafe) in integration tests phase. But if I understand correctly, if I would set -javaagent parameter to jybot script/command executed by robotframewok plugin it would just works, right?

Thank you very much.

d.

Marc Hoffmann

unread,
Apr 18, 2013, 1:42:42 PM4/18/13
to jac...@googlegroups.com
Hi,

correct. This is the nice thing about JaCoCo: All you need to do to
collect coverage information is to add the javaagent parameter to the
target VM.

Best regards,
-marc
>>> [1].
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out
> [2].
>
>
>
> Links:
> ------
> [1] https://groups.google.com/groups/opt_out
> [2] https://groups.google.com/groups/opt_out

Mirko Friedenhagen

unread,
Apr 18, 2013, 3:32:36 PM4/18/13
to jac...@googlegroups.com
Hello Dezider,

you are right, maybe you may just reuse argLine, see
https://github.com/1and1/attach-qar-maven-plugin/blob/15e0938eefe85b1d1f754ace036da250bb279cb9/pom.xml#L24
for an example, setting invoker.mavenOpts to argLine reuses the agent
during runs of the maven-invoker-plugin.

Regards
Mirko

Regards Mirko
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/
https://bitbucket.org/mfriedenhagen/

hurlm...@gmail.com

unread,
Feb 10, 2014, 6:02:29 PM2/10/14
to jac...@googlegroups.com
Hi Marc,

I am having trouble in getting the coverage for my robot test cases using jacoco coverage engine. I am able to integrate the jacoco agent and get the jacoco reports but when I run my robot test cases I am not getting the coverage.

Here is my configuration in POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<argLine>${failsafeArgLine}</argLine>
<skipTests>${skip.integration.tests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<version>${robot.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<testCasesDirectory>${project.basedir}/src/test/resources/scenarios</testCasesDirectory>
</configuration>
</plugin>

Thanks
Greg

hurlm...@gmail.com

unread,
Feb 10, 2014, 6:02:38 PM2/10/14
to jac...@googlegroups.com
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages