maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r406183 - /maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Date Sun, 14 May 2006 01:45:20 GMT
Author: brett
Date: Sat May 13 18:45:20 2006
New Revision: 406183

URL: http://svn.apache.org/viewcvs?rev=406183&view=rev
Log:
[MSUREFIRE-97] make sure you can mix test NG and junit tests when they are part of a directory
test suite

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

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=406183&r1=406182&r2=406183&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
Sat May 13 18:45:20 2006
@@ -24,7 +24,6 @@
 import org.testng.ISuiteListener;
 import org.testng.ITestListener;
 import org.testng.TestNG;
-import org.testng.internal.TestNGClassFinder;
 import org.testng.internal.annotations.IAnnotationFinder;
 import org.testng.xml.XmlClass;
 import org.testng.xml.XmlSuite;
@@ -83,7 +82,7 @@
         {
             annotationClass = Class.forName( "org.testng.internal.annotations.JDK14AnnotationFinder"
);
         }
-        
+
         annotationFinder = (IAnnotationFinder) annotationClass.newInstance();
     }
 
@@ -93,7 +92,7 @@
         // TODO: fix
         // override classloader. That keeps us all together for now, which makes it work,
but could pose problems of
         // classloader separation if the tests use plexus-utils.
-        return super.locateTestSets( getClass().getClassLoader() );
+        return super.locateTestSets( classLoader );
     }
 
     protected SurefireTestSet createTestSet( Class testClass, ClassLoader classLoader )
@@ -121,7 +120,7 @@
 
         createXmlTest( suite, testSet );
 
-        executeTestNG( suite, reporterManager );
+        executeTestNG( suite, reporterManager, classLoader );
     }
 
     public void execute( ReporterManager reporterManager, ClassLoader classLoader )
@@ -143,7 +142,7 @@
             createXmlTest( suite, testSet );
         }
 
-        executeTestNG( suite, reporterManager );
+        executeTestNG( suite, reporterManager, classLoader );
     }
 
     private void createXmlTest( XmlSuite suite, SurefireTestSet testSet )
@@ -160,16 +159,18 @@
             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
+        if ( "junit.framework.TestCase".equals( testSet.getTestClass().getSuperclass().getName()
) )
         {
             xmlTest.setJUnit( true );
         }
     }
 
-    private void executeTestNG( XmlSuite suite, ReporterManager reporterManager )
+    private void executeTestNG( XmlSuite suite, ReporterManager reporterManager, ClassLoader
classLoader )
     {
         TestNG testNG = new TestNG( false );
-        
+
         // turn off all TestNG output
         testNG.setVerbose( 0 );
 



Mime
View raw message