Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No coverage in 'all classes in scope' in Intellij

In Intellij IDEA 14.1.5 Community edition, I imported maven to get coverage from jacoco.exec file. Steps followed

  1. right click on imported module.

  2. select Analyze-->Show Converage Data.

  3. provided valid jacoc.exec file and click 'show selected'

Instead of coverage i'm getting error as no coverage in 'all classes in scope'

can anybody suggest what is wrong?

like image 845
fahad Avatar asked Nov 03 '15 10:11

fahad


People also ask

Why coverage is not showing in IntelliJ?

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.


3 Answers

I had the same thing happen to me.

I was able to fix this by going to "Edit Configurations", to the "Code Coverage" tab.

I'm not sure what caused it, but the wrong package namespace was listed there. I updated the entry there and my subsequent test run with code coverage succeeded.

like image 56
wachr Avatar answered Oct 20 '22 15:10

wachr


It happens if your test class and class to test are in different package structures.

My test class was in:

com.tools.api

Class to be tested was in:

com.tools.ws

Once I've corrected the pattern as com.tools.* in the code coverage tab, I was able to see coverage results.

like image 14
Harish Avatar answered Oct 20 '22 15:10

Harish


I had the same problem and found solution here.

In the Code Coverage tab, define the following options:

Specify the scope to measure code coverage for. Do one of the following: To specify a class, click the Add Class button.

To specify a package, click the Add Package button.

like image 4
SooBin Kim Avatar answered Oct 20 '22 13:10

SooBin Kim