Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jacoco is not showing coverage for PowerMockito classes

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

like image 943
Pradeep Avatar asked Oct 29 '22 00:10

Pradeep


1 Answers

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

like image 59
Makky Avatar answered Nov 15 '22 05:11

Makky