Code coverage in IntelliJ

Paz :

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

glytching :

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=465991&siteId=1
Recommended