Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Code coverage issue with powermock

han li
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 2, 2020

I'm using powermock to mock some static methods inside one of the project and I decided to use clover as the code coverage reporting tools since it seems that it can be compatible with the instrumental of powermock.

However, when I tried to trigger clover with the following command in the project:

>mvn clean clover:setup test clover:aggregate clover:clover

During the test phase, the log showed that 9 test methods detected, but only one of them was actually running and generated the results(the only one without powermock).

the current configurations in my pom.xml is as follows:

clover-plugin:

<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${clover.version}</version>
<configuration>
<flushPolicy>interval</flushPolicy>
<flushInterval>5000</flushInterval>
</configuration>
</plugin>

Powermock:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
</exclusion>
</exclusions>
</dependency>

I would be really appreciated if anyone could help me with the issue. Thank you.

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events