Branch coverage of java bytecode

15 views
Skip to first unread message

insomnia Lee

unread,
Sep 9, 2019, 12:19:43 PM9/9/19
to JaCoCo and EclEmma Users

Hello, those days, I have tried to develpoe a tool based on JaCoCo, I just want to get more information about branch coverage of java bytecode, I don't care which branch have been passed and which not. What I want to konw is that in a condtion like if(condition1&&condition2) , It's not necessary that if condition1 = true and condition2 = flase pass or not, But I want to know, in the four branch ( TT TF FT FF ) corresponding to ( A B C D ), We have four orderd condtion( a b c d ) which is not one-to-one with (ABCD), Their order is determined according to the analysis program. I want to know that if condition (a) have been passed or not. Can I analyze the probe array to get the branch coverage information? I am not sure about it. If you have an idea about how to do it, I will be very grateful, I am looking forward to your early reply, Thank you very much!!!

Marc Hoffmann

unread,
Sep 9, 2019, 2:38:49 PM9/9/19
to JaCoCo and EclEmma Users
Hi,

JaCoCo is based on bytecode. Internally it calculates the execution status and branched of every bytecode instruction (using execution data file together with the original class files). So JaCoCo does not evaluate the data (like condition1 and condition2 in your example). It simply looks at the control flow graph of the bytecode.

For example in your case you’re using the logical shortcut operator &&. Which means when condition1 == false then condition2 is not evaluated at all. So the cases FT and FF cannot be distinguished.

Some pointers for for further research.


Regards,
-marc




On 9. Sep 2019, at 18:19, insomnia Lee <insom...@gmail.com> wrote:


Hello, those days, I have tried to develpoe a tool based on JaCoCo, I just want to get more information about branch coverage of java bytecode, I don't care which branch have been passed and which not. What I want to konw is that in a condtion like if(condition1&&condition2) , It's not necessary that if condition1 = true and condition2 = flase pass or not, But I want to know, in the four branch ( TT TF FT FF ) corresponding to ( A B C D ), We have four orderd condtion( a b c d ) which is not one-to-one with (ABCD), Their order is determined according to the analysis program. I want to know that if condition (a) have been passed or not. Can I analyze the probe array to get the branch coverage information? I am not sure about it. If you have an idea about how to do it, I will be very grateful, I am looking forward to your early reply, Thank you very much!!!

--
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/b2eb1969-7505-4e1d-9e0b-7d5607d52648%40googlegroups.com.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages