coverage problem with powermockito

523 views
Skip to first unread message

han li

unread,
Feb 29, 2020, 1:32:59 AM2/29/20
to PowerMock

Hi Guys,

I’m having some issues while trying to generate code coverage report for powermockito test case. 

 

I wrote some unit tests for a java project in out system. Since there are some static methods that needed to be mocked, I used powermockito to mock those methods.

 

However, when I tried to integrate the test with code coverage report generating tool like cobertura along with sonarqube. The test class which was related to powermockito was not being included in the report.

We used to use Jacoco as the report generating tool, the reason that I chose to use cobertura is I saw online that cobertura could be compatible with powermockito perfectly since it can set the phase of instrumenting classes so that instrumentation of powermockito won’t erase the changes made by cobertura.

 

Has anyone faced similar issue before? Which coverage report generating tool can used to work with powermockito?

 

The artifact version I used is as below:

Maven: 3.5.0

Cobertura: 2.7

Surefire: 2.1.3

Powermockito: 2.0.2

 

Will be really appreciated if anyone could help me with the issue.

Fábio Lucena Ribas

unread,
Aug 31, 2020, 4:05:49 AM8/31/20
to PowerMock
Reply all
Reply to author
Forward
0 new messages