Need some explanations about the code coverage results

288 views
Skip to first unread message

Marc Ouédraogo

unread,
Jun 28, 2023, 4:10:22 AM6/28/23
to JaCoCo and EclEmma Users
Hello everyone, I'm writing to you for information or clarification on the results given by Jacoco. I'm a new Jacoco user and I'm lost.

I've been experimenting with Jacoco and have been able to report Branch coverage, Instruction coverage, Method coverage and Line coverage.
However, I didn't understand why Branch coverage is low, whereas Line coverage, Instruction coverage and even Method coverage are often close to 100%.

As an example, I'm sending you this image showing a summary table of the results.


I used Evosuite to generate the test cases.

Screenshot 2023-06-28 at 10.06.19.png
BRcov = Branch Coverage
IScov = Instruction coverage
MTcov = Method coverage
LIcov = Line coverage

Best regards,

Marc Hoffmann

unread,
Jun 29, 2023, 4:37:42 AM6/29/23
to JaCoCo and EclEmma Users
Hi Marc,

this is a common situation. Take for example the following code:

  if (x > 100) {
    print(“big”);
  }

If you test this code with x == 200 you will get 100% line and instruction coverage. But you still miss the branch where the if block is not executed.

If you drill down your coverage report to source level you see the specific lines where branches are missed.

Regards,
-marc


On 28. Jun 2023, at 10:10, Marc Ouédraogo <krycm...@gmail.com> wrote:

Hello everyone, I'm writing to you for information or clarification on the results given by Jacoco. I'm a new Jacoco user and I'm lost.

I've been experimenting with Jacoco and have been able to report Branch coverage, Instruction coverage, Method coverage and Line coverage.
However, I didn't understand why Branch coverage is low, whereas Line coverage, Instruction coverage and even Method coverage are often close to 100%.

As an example, I'm sending you this image showing a summary table of the results.


I used Evosuite to generate the test cases.

<Screenshot 2023-06-28 at 10.06.19.png>
BRcov = Branch Coverage
IScov = Instruction coverage
MTcov = Method coverage
LIcov = Line coverage

Best regards,

--
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/325b2090-8844-4787-8ee5-c8c73137b84en%40googlegroups.com.
<Screenshot 2023-06-28 at 10.06.19.png>

Marc Ouédraogo

unread,
Jun 29, 2023, 5:37:59 AM6/29/23
to JaCoCo and EclEmma Users
Hello marc, 

Many thanks for your response.

It's more clear for me now!

Best regards,

Reply all
Reply to author
Forward
0 new messages