Jacoco plugin usage with end to end tests

Hi,
I just want to check I have not missed anything in trying to get coverage reports that include my end to end tests.

I don’t see any docs in the Gradle Jacoco plugin docs that indicate that I can measure the coverage with the plugin when executing my UI and services API tests.

We have of course got plugin doing it’s useful stuff on the unit levels tests and I collate all the executions via a JacocoReport task.

I’ll add that I know it can be done as I see that we can achive the measurement with TeamCity build configuration.

It would be great if there’s some magic I can apply on the gradle build script that I have missed.

I have tried setting the jvmargs in the gradle.properties file:

org.gradle.jvmargs=-Xms512m -Xmx4096m -javaagent:/home/xxx/jacocoagent.jar=append=true,destfile=xxx/test.exec

I’m not quite sure yet whether this is giving me what I need (does not seem to be and stopping for now pending some useful responses here), but I have the following issue with this approach:

  • Have to download and keep the jacocoagent jar in my repo and there is potential for it get out of sync with the plugin as we move to later versions of gradle (this is of course just the risk of forgetting to keep them in sync).

So have I missed anything in docs that I should have spotted? Thanks for any help offered.

See

  • #1 dynamically create a property file with the jacoco config
  • #2 adding the folder to the test classpath and
  • #3 copying the contents to gradle.properties in the test directory