2

I managed to build our tests with help of this tutorial https://confluence.atlassian.com/display/CLOVER/Using+Clover+with+Maven+Tycho+Plugin, coverage data is generated, but there is one small problem:

All tests that are being run with @Parameterized annotation are failing with

java.lang.NoClassDefFound: junit/runner/TestRunListener

From what I've found so far the exception is comming from JUnitParameterizedTestSniffer that is injected by clover.

Do you have any idea how to fix this?

We're using maven3, tycho 0.22, java7, junit 4.11.

2 Answers2

0

This sounds like the package junit/runner is not visible in the test's class loader. This happens if you only import selected packages from the JUnit bundle.

If you instead use a Require-Bundle of the JUnit bundle, the class loading issue should no longer occur.

oberlies
  • 11,503
  • 4
  • 63
  • 110
0

Finally I've solved this problem using this piece of code after instrumentation:

<replace dir="${project.instrumented.dir}" token="new com_atlassian_clover.JUnitParameterizedTestSniffer()" value="com_atlassian_clover.TestNameSniffer.NULL_INSTANCE">
    <include name="**/*.java"/>
</replace>

Maybe it is not the prettiest solution - but it works just fine. The question was also asked at Atlassian Answears (https://answers.atlassian.com/questions/32508110/answers/32530869)