Emma code coverage with JUnit and Powermock

I am using JUnit with Powermockito mockery. I need to work in a CLI environment with maven or ant.

emma version:      ema-2.0.5312
powermock version: powermock-mockito-1.5.1-full
junit version:     junit-4.9

When I run junit with the following command, everything works:

java org.junit.runner.JUnitCore some.package.ClassTest

However, when I used emma to check for code coverage:

java emmarun -cp $CLASSPATH -report txt org.junit.runner.JUnitCore some.package.ClassTest

I got the following error:

1) initializationError(some.pakage.ClassTest)
   java.lang.ClassCastException: org.powermock.modules.junit4.PowerMockRunner cannot be cast to org.junit.runner.Runner

Other test classes without using powermock work fine. Does anyone have any suggestion? thanks in advance.

+3
source share
1 answer

when using powermock you cannot recognize coverage using Emma

See discussion on developer side

+1
source

All Articles