I see that the build-in code coverage in Intellij is pretty minimal (only include line coverage, and not branch coverage).
What are the recommended code coverage libraries to work with IntelliJ?
(I used to work with Jacoco in Eclipse).
Coverage in the Coverage tool window If you want to reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The report shows the percentage of the code that has been executed or covered by tests. You can see the coverage result for classes, methods, and lines.
From the main menu, select Run | Show Coverage Data ( Ctrl+Alt+F6 ). In the Choose Coverage Suite to Display dialog, select the checkboxes next to the necessary suites, and click Show selected. IntelliJ IDEA opens the coverage results for the selected test suites.
Code coverage in IntelliJ IDEA allows you to see the extent to which your code has been executed. It also lets you verify the extent to which your code is covered by unit tests, so that you can estimate how effective these tests are.
Code coverage option is available under the Test menu when you run test methods using Test Explorer. The results table shows the percentage of the code executed in each assembly, class, and procedure. The source editor highlights the tested code.
The IntelliJ IDEA code coverage runner provides branch coverage.
Tracing mode enables accurate collection of the branch coverage, with the ability to track tests, view coverage statistic, and get additional information on each covered line.
(From the docs)
To engage this, open the Edit Run/Debug Configuration
dialog box for your test run and click on the Code Coverage
tab. Then ...
IntelliJ IDEA
Tracing
(instead of the default: Sampling
)Run your test and then click into the class from the Coverage Window and you'll see branch information in the side bar.
Here's a screenshot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With