Paz
Paz

Reputation: 1099

Code coverage in IntelliJ

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).

Upvotes: 9

Views: 13336

Answers (1)

glytching
glytching

Reputation: 47865

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 ...

  • Chose coverage runner: IntelliJ IDEA
  • Click on 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:

enter image description here

Upvotes: 16

Related Questions