Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open JaCoCo report in Intellij IDEA

I am trying to find dead code on our application by using a code coverage tool (rather a static code analysis tool). I have chosen JaCoCo and am able to get a report thanks to the JaCoCo agent.

I know that Intellij IDEA works with JaCoCo but I couldn't find anyway to import my JaCoCo report into Intellij IDEA. Any idea on how to do that?

Thanks

like image 735
tibo Avatar asked Jan 29 '14 01:01

tibo


People also ask

How do I open a JaCoCo report?

Step 4: To get you code coverage report navigate to the target > site > jacoco > index. html > right-click > Open In > Browser > And your preferred browser. So basically index. html is your code coverage report file.

How do I get a report from JaCoCo?

For generating JaCoCo reports only run the maven build with profile jacoco-generate-report as it is shown in the example above. After the command was executed, in directory target/jacoco-report you can find reports in HTML and XML formats.

How do I get code coverage report in IntelliJ?

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.


2 Answers

Found the solution. I have installed the coverage plugin and the EclEmma plugin (not sure if this one is really necessary...). Then "Analyse -> Show Coverage Data..." and pick your Jacoco output file. This file HAS to have the .exec extension, otherwise you can't select it. That was my problem...

Thanks

like image 107
tibo Avatar answered Sep 26 '22 14:09

tibo


For everyone being stuck (like me) trying to find the Show Coverage Data... action. It's been relocated to the Run section.

As you can read in the official documentation (Version 2020.3), the action can be reached by using the quick search, the various keymaps or by navigating to Run > Show Coverage Data....

like image 41
Jonathan Hassel Avatar answered Sep 22 '22 14:09

Jonathan Hassel