how to use jacoco.exec report

wlhee picture wlhee · Jul 31, 2013 · Viewed 95.1k times · Source

I generated a code coverage report from jacoco, which is jacoco.exec. But I don't know how to use it ...

The way I generated it is through command line:

java -javaagent:/path/to/jacocoagent.jar=include=some.package.*,output=file org.junit.runner.JUnitCore some.package.ClassTest

Then I got the jacoco.exec report. All I need is just the number of percentage, and I am using command line only. Is there a way to convert this report to a readable txt file?

Thanks all

Answer

Roberto picture Roberto · May 3, 2017

In IntelliJ Idea from the menu select Analyze > Show Coverage data. In the new window press the + button and select your .exec file. The test coverage results will appear in the editor Coverage tab.

Update:

In the latest version of Intellij Idea the menu has been moved to Run > Show Code Coverage Data