Setting up Jacoco using gradle to calculate java code coverage during System Testing

JaCoCo has two methods of operation, on the fly instrumentation via the java agent and offline instrumentation

I suggest you use on-the-fly instrumentation and add the jacoco agent to the jvm args of your application prior to running jasmine/selenium. See here for an example which adds the jacoco agent to the testkit jvm in a gradle build.

If you instead want gradle to invoke offline instrumentation I’d guess you’d want to invoke the jacoco ant task (assuming one exists).

For reference the gradle jacoco plugin uses on-the-fly instrumentation and doesn’t invoke offline instrumentation.

1 Like