Jacoco code coverage for tests which targets another module

Hello
I have a java multi module project managed through maven.
Here is the structure:

parent-pom.xml

   _________Module1
              |____src/main/java
              |____src/test/java
   
   _________Module2
               |___src/main/java
               |___src/test/java
   
   _________Module3
                |___src/test/java additional tests on classes of Module1
   
   _________Coverage 
                |___pom.xml with dependencies on Module1 and Module2 and Module3 

Module1 has source code and unit tests on Module1
Module2 has source code unit test on Module2
Module3 has only tests for classes in Module1. Indeed it only has the folder src/test/java/…

Thanks to the jacoco-maven-plugin on each module and the report-aggregate maven goal in the coverage project, I managed to obtain the code coverage of Module1 and Module2.

However, the coverage of Module3 is 0% since the classes that are being tested are not inside Module3. Indeed the classes under tests are inside Module1.

Is there a way to get the code coverage of Module3 against Module 1 ?

Looking forward to receiving any help

Hi,

Welcome to the community!

Ehm… There’s no source code in Module3. Are you sure it’s coverage isn’t - (i.e. null)?

This isn’t a question that has come up in a while, so my memory is a bit fuzzy on the topic, but I believe it’s going to be a struggle.

If you look at the Module3 report, what do the paths for the source files look like? Would they be easily understood as belonging to Module1?

 
Ann