maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fgi...@apache.org
Subject svn commit: r438894 - in /maven/surefire/trunk/surefire-providers/surefire-testng: pom.xml src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
Date Thu, 31 Aug 2006 12:38:31 GMT
Author: fgiust
Date: Thu Aug 31 05:38:30 2006
New Revision: 438894

URL: http://svn.apache.org/viewvc?rev=438894&view=rev
Log:
PR: MSUREFIRE-134 Surefire finds test classes but ignores test methods and configuration methods
with TestNG and includes tag
Submitted by: Jesse Kuhnert
Reviewed by: Fabrizio Giustina

Modified:
    maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml?rev=438894&r1=438893&r2=438894&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml Thu Aug 31 05:38:30 2006
@@ -33,7 +33,7 @@
         <dependency>
           <groupId>org.testng</groupId>
           <artifactId>testng</artifactId>
-          <version>4.7</version>
+          <version>5.1</version>
           <classifier>jdk14</classifier>
         </dependency>
       </dependencies>
@@ -47,7 +47,7 @@
         <dependency>
           <groupId>org.testng</groupId>
           <artifactId>testng</artifactId>
-          <version>4.7</version>
+          <version>5.1</version>
           <classifier>jdk15</classifier>
         </dependency>
       </dependencies>

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=438894&r1=438893&r2=438894&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Thu Aug 31 05:38:30 2006
@@ -134,7 +134,7 @@
         XmlSuite suite = new XmlSuite();
         suite.setParallel( parallel );
         suite.setThreadCount( threadCount );
-
+        
         for ( Iterator i = testSets.values().iterator(); i.hasNext(); )
         {
             SurefireTestSet testSet = (SurefireTestSet) i.next();
@@ -150,6 +150,7 @@
         XmlTest xmlTest = new XmlTest( suite );
         xmlTest.setName( testSet.getName() );
         xmlTest.setXmlClasses( Collections.singletonList( new XmlClass( testSet.getTestClass()
) ) );
+        
         if ( groups != null )
         {
             xmlTest.setIncludedGroups( Arrays.asList( groups.split( "," ) ) );
@@ -158,13 +159,20 @@
         {
             xmlTest.setExcludedGroups( Arrays.asList( excludedGroups.split( "," ) ) );
         }
-
-//        if ( !TestNGClassFinder.isTestNGClass( testSet.getTestClass(), annotationFinder
) )
+        
+        // if ( !TestNGClassFinder.isTestNGClass( testSet.getTestClass(), annotationFinder
) )
         // TODO: this is a bit dodgy, but isTestNGClass wasn't working
         try
         {
-            Class junitClass = Class.forName( "junit.framework.Test" );
-            xmlTest.setJUnit( testSet.getTestClass().isAssignableFrom( junitClass ) );
+        	Class junitClass = Class.forName( "junit.framework.Test" );
+        	Class junitBase = Class.forName( "junit.framework.TestCase" );
+        	
+        	if ( junitClass.isAssignableFrom( testSet.getTestClass() )
+                || junitBase.isAssignableFrom( testSet.getTestClass() ) )
+            {
+                xmlTest.setJUnit( true );
+            }
+
         }
         catch ( ClassNotFoundException e )
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java?rev=438894&r1=438893&r2=438894&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
Thu Aug 31 05:38:30 2006
@@ -59,9 +59,11 @@
             testNG.setSourcePath( testSourceDirectory );
         }
         
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        Thread.currentThread().setContextClassLoader( suite.getClass().getClassLoader() );
+        // 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 );
+        //Thread.currentThread().setContextClassLoader( oldClassLoader );
     }
 }



Mime
View raw message