Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why EclEmma doesn't coverage code with tests with @RunWith(PowerMockRunner.class)

I am using EclEmma with Eclipse to help me to know where is missing code tests in my project, but all tests with @RunWith(PowerMockRunner.class) are not called and thus not tested.

I´m using JUnit 4.8.1 with Mockito.

What could it be?

like image 622
LottaLava Avatar asked Mar 15 '12 18:03

LottaLava


People also ask

How do I get code coverage with PowerMock?

Put your powermock test logic in other simple java class inside test package, and call the merhod from test class, it increase code coverage for your application.

Is JaCoCo and EclEmma same?

JaCoCo is a free code coverage library for Java, which has been created by the EclEmma team based on the lessons learned from using and integration existing libraries for many years.

Does JaCoCo work with PowerMock?

JaCoCo Offline Instrumentation works only with PowerMock version 1.6. 6 and above. You may find example of using PowerMock with JaCoCo Offline Instrumentation and Maven in our repository: jacoco-offline example.


1 Answers

Its a known bug reported for both parties:

http://code.google.com/p/powermock/issues/detail?id=402 https://github.com/jacoco/eclemma/issues/15#issuecomment-9565210

eCoberture seems however to provide correct coverage. The only problem, that it seems not to be maintained anymore, and you cannot remove the highlights im Eclipse Juno.

like image 130
Gábor Lipták Avatar answered Sep 19 '22 12:09

Gábor Lipták