Inquiry About Tracking Execution Statement Order of Java Applications Using JaCoCo

25 views
Skip to first unread message

mai

unread,
Aug 21, 2024, 12:53:19 AM8/21/24
to JaCoCo and EclEmma Users

Dear developers,

Hello! I understand that JaCoCo inserts Boolean probes to collect code coverage information. Currently, I am interested in collecting information about the sequence of statements executed by a Java application during test case execution. Could you please inform me if it is possible to directly obtain this information using JaCoCo? If not, could you advise which files within JaCoCo I should focus on to achieve this goal? I look forward to your response.

Best regards,

Mai

mai

unread,
Aug 21, 2024, 12:53:19 AM8/21/24
to JaCoCo and EclEmma Users

Marc Hoffmann

unread,
Aug 21, 2024, 1:04:22 AM8/21/24
to JaCoCo and EclEmma Users
Dear Mai,

exactly, JaCoCo stores a boolean array per class to record execution status. The documentation provides an overview of the implementation:


JaCoCo does not record the sequence of probes (this would result in a large list of probe identifiers). I can’t point you to specific files to achieve this, you will need to implement a new runtime for such a global list. Also you need a new analysis implementation that provides the information in some meaningful way (again, this will be huge for typical executions).

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/ce84e5f1-4c9a-4988-a3c4-169c12f655b1n%40googlegroups.com.

mai

unread,
Aug 28, 2024, 10:57:39 PM8/28/24
to JaCoCo and EclEmma Users
Thank you for your reply. I still have some uncertainties regarding the probe insertion points used by JaCoCo. I'm somewhat unclear about the insertion of probes of the SEQUENCE type, which, according to the documentation(https://www.jacoco.org/jacoco/trunk/doc/flow.html), are inserted between two instructions. 
However, after reviewing the MethodProbesAdapter section of JaCoCo's code, it seems to me that JaCoCo inserts probes at the following locations: 
1. before return/throw statements; 
2. at jumps and switches that have multiple targets; 
3. at the beginning and end of the try block in try-catch constructs, as well as at the beginning of the catch block. 
Could you confirm if my understanding is correct?

Marc Hoffmann

unread,
Aug 29, 2024, 12:09:37 AM8/29/24
to JaCoCo and EclEmma Users
Hi,

“SEQUENCE” is only one strategy. As you can see in the table there are more cases like “JUMP”, “EXHANDLER” and “EXIT” for the other implementations in MethodProbesAdapter.

Regards,
-marc


Reply all
Reply to author
Forward
0 new messages