Jacoco is not showing coverage for PowerMockito classes

Pradeep picture Pradeep · Oct 16, 2017 · Viewed 9.6k times · Source

We are using Jacoco and eclemma for test case coverage. For the classes that are not using PowerMockRunner we are getting coverage properly in both.For the classes that uses PowerMockRunner we are facing issue with coverage like it shows 0 % coverage in jacoco but shows proper coverage in eclemma.

PowerMockito version :1.7.1
Jdk 1.8
Jacoco:0.7.9

I tried to use PowerMockRunner rule also but this causes another error related to verify stackframe which is very difficult to fix. Eclemma is used as eclipse plugin and jacoco is used as maven plugin. Any one who has faced this issue and are able to fix this can shed some light on this.I have gone through many links but none of them worked out for me.

Some useful reference:

PowerMock ECLEmma coverage issue

Answer

Makky picture Makky · Oct 16, 2017

PowerMock does not work with Jacoco

Jira for the bug

Jacoco and powermock don't work well , so in order to get coverage we can use offline version of jacoco.

I had put together an example

https://github.com/muhdkhokhar/powermock-jacoco-coverage