Correlation between jUnit tests and source code classes/methods

20 views
Skip to first unread message

Ljubisa Punosevac

unread,
Dec 9, 2024, 3:21:24 AM12/9/24
to JaCoCo and EclEmma Users
Hi everyone, 

I am trying to create a source code class/method map with junit tests that covers it. 

I was wondering can JaCoCo help with this task since it already does it? 

So far what I could do was to match JaCoCo XML report timestamps with a jUnit XML report timestamps, but  that method is unreliable. 

I have over 40k of jUnit tests and I would like to skip most of them and execute only those that are affected by source code changes. Right now, to execute this many jUnit tests it takes 20 agents on CI/CD for about 60-70mins. 

I know there are tools that help with this, but I was wondering can I do it with JaCoCo current set of features somehow or maybe to extend it a bit in that direction?

Thank you upfront for your answers/suggestions. 


Best,
Ljubisa.

Marc Hoffmann

unread,
Dec 9, 2024, 3:31:23 AM12/9/24
to jac...@googlegroups.com
Hi Ljubisa,

the following approach has been implemented before: You can hook into the JUnit framework to dump and reset the coverage data after every test. For this the JaCoCo agent offers a runtime API. With setSessionId() you can set an arbitrary String to identify the executed test.

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 visit https://groups.google.com/d/msgid/jacoco/102da947-aa91-43b0-8e44-2a38dc6848ecn%40googlegroups.com.

Ljubisa Punosevac

unread,
Dec 9, 2024, 4:49:39 AM12/9/24
to JaCoCo and EclEmma Users
Hi Marc,

Thank you very much for your quick feedback. I will give it a try and see can I follow your suggestion. 

Best,
Ljubisa. 
Reply all
Reply to author
Forward
0 new messages