You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Brett Porter (JIRA)" <ji...@codehaus.org> on 2007/02/23 08:06:02 UTC

[jira] Updated: (SUREFIRE-165) TestNG JDK1.4 JavaDoc annotated classes never run ... and now I know why.

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

Brett Porter updated SUREFIRE-165:
----------------------------------

    Fix Version/s:     (was: 2.3)
                   2.4

> TestNG JDK1.4 JavaDoc annotated classes never run ... and now I know why.
> -------------------------------------------------------------------------
>
>                 Key: SUREFIRE-165
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-165
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: - WinXP
> - Maven 2.0.4 (with maven-surefire-plugin 2.2)
>            Reporter: Davy Toch
>             Fix For: 2.4
>
>         Attachments: m2-testng-example-jdk14.zip
>
>
> After a day of trying to find out why JDK1.4 JavaDoc annotated test classes were never run, I finally found out why:
> In maven-surefire\surefire-providers\surefire-testng\src\main\java\org\apache\maven\surefire\testng\TestNGExecutor.java, the method testng.runSuitesLocally() is called:
> static void executeTestNG( SurefireTestSuite surefireSuite, String testSourceDirectory, XmlSuite suite,
>                            ReporterManager reporterManager )
> {
>   ...
>   // TODO: Doesn't find testng.xml based suites when these are un-commented
>   // TestNG ~also~ looks for the currentThread context classloader
>   // ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
>   // Thread.currentThread().setContextClassLoader( suite.getClass().getClassLoader() );
>   testNG.runSuitesLocally();
>   //Thread.currentThread().setContextClassLoader( oldClassLoader );
>   ...
> }
> However, in the TestNG 5.1 source file org\testng\TestNG.java, only the method run() correctly loads the JDK1.4 annotations. So the above class should call testng.run() and not testng.runSuitesLocally().
> org\testng\TestNG.java:
>   /**
>    * Run TestNG.
>    */
>   public void run() {
>     // lazy scan sourcedirs if needed
>     if(isJdk14() || JAVADOC_ANNOTATION_TYPE.equals(m_target)) {
>       AnnotationConfiguration.getInstance().getAnnotationFinder().addSourceDirs(m_sourceDirs);
>     }
>     ...
>   }
> The problem is also still present in the latest 2.3-SNAPSHOT version of the maven-surefire-plugin.
> Included a small example project to illustrate the problem (just run "maven test").

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira