Missed cross-module code coverage using Jacoco offline instrumentation in gradle project

79 views
Skip to first unread message

Sergiy Gnatyuk

unread,
Feb 4, 2020, 2:40:43 PM2/4/20
to JaCoCo and EclEmma Users

I've tried to setup Jacoco(offline instrumentation) in my gradle multi-module project. I have to use offline instrumentation because there are multiple PowerMock tests in the project.

I have two modules: A and B. Module A has tests that partially cover a code from module B but such code coverage data is missed in my summary report.


My configuration based on stackoverflow answer Jacoco offline instrumentation Gradle script

I've created a test project that demonstrates the issue: https://github.com/SurpSG/jacoco-offline-instrumentation


On the other hand, when I'm using jacoco gradle plugin I can observe that coverage data provided by module A for module B successfully collected to a summary report. 

I've created one more test project to demonstrate this: https://github.com/SurpSG/jacoco-gradle-plugin-merge-coverage


Is it a way to collect cross-module code coverage by fixing my build script configuration?

Sergiy Gnatyuk

unread,
Feb 10, 2020, 2:14:18 PM2/10/20
to JaCoCo and EclEmma Users
To collect cross-module code coverage using jacoco offline instrumentation we need to add jars with instrumented classes to dependent module's classpath.

kajal gupta

unread,
Oct 21, 2020, 9:30:22 AM10/21/20
to JaCoCo and EclEmma Users
Hey,
I am not able to get coverage for all the modules using the above mentioned links.
We have a root project called A, which has multiple sub-projects - n1, n2, n3,... The code coverage report is successful for subprojects.
We want to have the code coverage report added at the root level with this jacoco offline instrumentation approach. 
Gradle version - 6.6 
Java version - 1.8
Reply all
Reply to author
Forward
0 new messages