You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (JIRA)" <ji...@codehaus.org> on 2012/07/03 19:50:21 UTC

[jira] (SUREFIRE-876) surefire-junit47 does not work in an OSGi classloader environment

     [ https://jira.codehaus.org/browse/SUREFIRE-876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy reassigned SUREFIRE-876:
-------------------------------------

    Assignee: Olivier Lamy
    
> 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
>            Assignee: Olivier Lamy
>
> 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