Same Report generated for 2 different Junit running on 2 different VMs

14 views
Skip to first unread message

Ashish Ranjan Sinha

unread,
Aug 2, 2024, 1:06:42 AM8/2/24
to JaCoCo and EclEmma Users
Hi Everybody,

I am using runtime instrumentation with the JaCoCo agent in the JVM and running different JUnit tests on two independent VMs in a multi-module project. The classfiles in these two VMs are the same. I am using JaCoCo 0.8.11 on each VM, with each VM storing its own copies of jacocoagent.jar and jacococli.jar. The goal of running two different VMs with the same classfiles is to achieve parallelism and reduce overall execution time. The execution data is stored with the names jacoco1.exec and jacoco2.exec, respectively. However, when generating and comparing the reports from these two VMs, I observe that every figure in each column is identical. Every value for missed branches and coverage percentage is the same. I am confident that the JUnit tests, even if they touch the same classfiles at times, should not display identical values. I have tried using different execution data names and cleaning the JaCoCo coverage cache, but the results remain unchanged.

Help would be much appreciated!

Regards,
Ashish

Marc Hoffmann

unread,
Aug 2, 2024, 2:45:17 AM8/2/24
to JaCoCo and EclEmma Users
Hi Ashish,

depending how you generate the report this might be by design:

  • When you create the reports separately, one using jacoco1.exec, the other report using jacoco2.exec only, you should see different figures.
  • When you create the reports in one run with both jacoco1.exec and jacoco2.exec coverage data will be merged and you will see the combined coverage.

So it depends on how you create the reports.

Regards,
-marc


--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/a08f70a8-bd49-4879-8945-8466dba58c43n%40googlegroups.com.

Ashish Ranjan Sinha

unread,
Aug 2, 2024, 3:45:49 AM8/2/24
to JaCoCo and EclEmma Users
Hi Marc,

Thank you for a swift response. 

I am generating report using jacoco1.exec separately and using jacoco2.exec separately. These reports are generated on two different independent VMs. Had they been generated on one VM, I could have understood it could have combined the coverage. But here we are generating in two separate VMs.

Regards,
Ashish

Marc Hoffmann

unread,
Aug 2, 2024, 3:58:43 AM8/2/24
to jac...@googlegroups.com
Ok. You can check the exec sources of your reports by following the „sessions“ link on the top right corner. Do the entries reflect what you expect?

If the reports are identical beside executed on different machines I see two options:

1) Your tests are deterministic, which is a good thing
2) JaCoCo has a hidden teleportation feature I‘m not aware of :)

On 2. Aug 2024, at 09:45, Ashish Ranjan Sinha <ashishra...@gmail.com> wrote:

Hi Marc,
Reply all
Reply to author
Forward
0 new messages