Jan Sievers created SUREFIRE-876:
------------------------------------

             Summary: surefire-junit47 does not work in an OSGi classloader 
environment
                 Key: SUREFIRE-876
                 URL: https://jira.codehaus.org/browse/SUREFIRE-876
             Project: Maven Surefire
          Issue Type: Improvement
          Components: classloading, Junit 4.7+ (parallel) support
    Affects Versions: 2.10
            Reporter: Jan Sievers


while trying to port JUnitCoreProvider to tycho, I noticed that it fails with 
an NPE when run inside an OSGi environment.

The root cause is really JUnit bug
https://github.com/KentBeck/junit/issues/364

JUnit uses Class.forName() to load the test class which assumes the JUnit 
classloader can always load test classes, which is not true in an OSGi 
classloader environment.

While this should be fixed in JUnit, it's easy to work around this issue in 
surefire.

It's not necessary to use the offending 
org.junit.runner.Description.getTestClass() in 
JUnitCoreRunListener.fillTestCountMap(). We can use String getClassName() 
instead to circumvent classloading issues as we only need the class name anyway.

I will attach a patch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to