Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coverage view shows 0.0% in Intellij when using Jacoco

As discussed in Open JaCoCo report in Intellij IDEA, when I gather code coverage statistics using Jacoco (rather than native IntelliJ tracing) 0.0% (i.e. "no" coverage) is always shown in the coverage window.

This is after I have done the whole "Analyze -> Show coverage data..." and selected my generated "jacoco.exec" file.

The same "jacoco.exec" file works fine with other tools such as the Jacoco native report generation task, and with Sonar, and these produce the expected coverage report content.

Also native IntelliJ instrumentation works fine.

Can anybody advise me if there is some essential step I must perform to get IntelliJ to accept my Jacoco coverage?

like image 531
robert Avatar asked Nov 24 '15 15:11

robert


Video Answer


2 Answers

When you add the class to PowerMockito annotation @PrepareForTest for the test classes, the corresponding class will not be showing the code coverage.

like image 122
Ram Avatar answered Oct 20 '22 04:10

Ram


I may guess you are trying to see test coverage in same way as it is show by the TeamCity(jaCoCo). If Yes there are simple workaround how to check all missed branches(just general statistic which branches was visited and how many times) :

enter image description here

enter image description here

That's all my advices , folks

like image 29
Andrew Avatar answered Oct 20 '22 02:10

Andrew