PowerMock ECLEmma coverage issue

Yes, there is a solution for this:

First you will have to add this maven dependency:

<dependency>
  <groupId>org.powermock</groupId>
  <artifactId>powermock-module-junit4-rule-agent</artifactId>
  <version>1.6.4</version>
  <scope>test</scope>
</dependency>

Then, instead of using this annotation @RunWith(PowerMockRunner.class), just add a @Rule in the Test class like this:

public class Test {

   @Rule
   public PowerMockRule rule = new PowerMockRule();

you can find more in this blog Make EclEmma test coverage work with PowerMock

Leave a Comment