-
1. Re: Jacoco extension does not work with gradle
kwintesencja Jun 10, 2014 10:05 AM (in response to ivan.macalak)Hi there,
only declaring the extension and dependency isn't enough.
First you need to start jacoco agent, in maven its done via plugin with goal prepare-agent
and later you need to generate reports based on jacoco inspection you started in previous step(jacoco.exec file), in maven its also done at plugin level.
with gradle you may take a look at: http://www.gradle.org/docs/current/userguide/jacoco_plugin.html
i hope it helps
-
2. Re: Jacoco extension does not work with gradle
ivan.macalak Jun 11, 2014 8:52 AM (in response to kwintesencja)Hi Rafael,
thanks for the quick answer.
My generated jacoco.exec file does not contain coverage info of my EJBs and other components deployed as part of Arquillian tests.
I'm using the ZipImporter to build ear archive to avoid redeploying for each test suite.
It seems that coverage of ear is not currently supported by Alpha6 version of jacoco extension. (https://issues.jboss.org/browse/ARQ-1387)
Is there any plan to add such support?
Ivan.
-
3. Re: Jacoco extension does not work with gradle
aslak Jun 12, 2014 3:08 AM (in response to ivan.macalak)It wasn't supported in <= Alpha5. Alpha6 should support it.
-
4. Re: Jacoco extension does not work with gradle
bmajsak Jul 11, 2014 8:20 AM (in response to aslak)Did it help Ivan Macalak? If so we can close this thread.
-
5. Re: Jacoco extension does not work with gradle
ivan.macalak Jul 22, 2014 10:10 AM (in response to bmajsak)Hi, I'm still not able to get it to work. The jacoco.exec generated by gradle plugin does not contain coverage info for classes executed as part of arquillian test run.
It seems, only maven is supported. Or can you provide some working example with gradle?
-
6. Re: Jacoco extension does not work with gradle
jean.rev Mar 16, 2015 10:39 AM (in response to ivan.macalak)This thread is already old, but just in case, we managed to make Jacoco work with Arquillian and Gradle with the following configuration:
On root project:
subprojects { apply plugin: 'java' apply plugin: 'jacoco' jacoco { toolVersion = '0.7.4.201502262128' reportsDir = file("$buildDir/jacoco") } }
On the sub-project to be tested with Arquillian:
dependencies { testCompile 'YOUR_ARQUILLIAN_ADAPTER' testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:1.1.5.Final' testCompile 'org.jboss.arquillian.extension:arquillian-jacoco:1.0.0.Alpha7' } // Important: add the Jacoco libs on the test classpath (required for the Jacoco Arquillian extension to work). sourceSets { test.runtimeClasspath += configurations.jacocoAnt }
And that's it.