Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA Testing - How to display branch coverage

In Eclipse with jacoco, I can get branch coverage percentage.

enter image description here

But in IntelliJ IDEA, I can only get lines&method coverage percentage in coverage window.

enter image description here

How to summarize branch coverage in IntelliJ IDEA?

like image 671
Lixin Wei Avatar asked Dec 15 '25 00:12

Lixin Wei


2 Answers

In IntelliJ to add "branch coverage" to the coverage window, you can go to Run/EditConfiguration then proceed to Modify options/coverage setting and enable use tracing.

Here is an example branch coverage example

like image 161
maryamezzaty24 Avatar answered Dec 16 '25 17:12

maryamezzaty24


First, by default intellij not showing the branch coverage inside Coverage window.
Personally, I think it is better to show it by default.

So if you are interested in "branch coverage", you need to activate its config Use tracing.

You have 2 options:

  1. Set the config "Globbaly" for all tests:
  • You can change the template of RUN/DEBUG config by follow the below steps:

enter image description here

  1. Set the config "Custom" for one test RUN/DEBUG config:
  • You can change the cutom of RUN/DEBUG config for a partuiclar test by follow the below ste:

enter image description here

like image 38
ahmednabil88 Avatar answered Dec 16 '25 16:12

ahmednabil88



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!