PowerMock ECLEmma coverage issue

前端 未结 8 1811
无人共我
无人共我 2020-11-30 09:39


We are using EasyMock and PowerMock with JUnit. The coverage tool used is ECLEmma. With EasyMock, it shows the coverage properly in green (as covered). However, for

8条回答
  •  无人及你
    2020-11-30 10:32

    Yes, there is a solution for this:

    First you will have to add this maven dependency:

    
      org.powermock
      powermock-module-junit4-rule-agent
      1.6.4
      test
    
    

    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

提交回复
热议问题