You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by br...@apache.org on 2006/03/04 12:06:28 UTC
svn commit: r383085 -
/maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Author: brett
Date: Sat Mar 4 03:06:25 2006
New Revision: 383085
URL: http://svn.apache.org/viewcvs?rev=383085&view=rev
Log:
[MSUREFIRE-23] correct forkMode=pertest for TestNG
Modified:
maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Modified: maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=383085&r1=383084&r2=383085&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java Sat Mar 4 03:06:25 2006
@@ -101,6 +101,29 @@
return new TestNGTestSet( testClass );
}
+ public void execute( String testSetName, ReporterManager reporterManager, ClassLoader classLoader )
+ throws ReporterException, TestSetFailedException
+ {
+ if ( testSets == null )
+ {
+ throw new IllegalStateException( "You must call locateTestSets before calling execute" );
+ }
+ SurefireTestSet testSet = (SurefireTestSet) testSets.get( testSetName );
+
+ if ( testSet == null )
+ {
+ throw new TestSetFailedException( "Unable to find test set '" + testSetName + "' in suite" );
+ }
+
+ XmlSuite suite = new XmlSuite();
+ suite.setParallel( parallel );
+ suite.setThreadCount( threadCount );
+
+ createXmlTest( suite, testSet );
+
+ executeTestNG( suite, reporterManager );
+ }
+
public void execute( ReporterManager reporterManager, ClassLoader classLoader )
throws ReporterException, TestSetFailedException
{
@@ -117,24 +140,34 @@
{
SurefireTestSet testSet = (SurefireTestSet) i.next();
- 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( "," ) ) );
- }
- if ( excludedGroups != null )
- {
- xmlTest.setExcludedGroups( Arrays.asList( excludedGroups.split( "," ) ) );
- }
-
- if ( !TestNGClassFinder.isTestNGClass( testSet.getTestClass(), annotationFinder ) )
- {
- xmlTest.setJUnit( true );
- }
+ createXmlTest( suite, testSet );
}
+ executeTestNG( suite, reporterManager );
+ }
+
+ private void createXmlTest( XmlSuite suite, SurefireTestSet testSet )
+ {
+ 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( "," ) ) );
+ }
+ if ( excludedGroups != null )
+ {
+ xmlTest.setExcludedGroups( Arrays.asList( excludedGroups.split( "," ) ) );
+ }
+
+ if ( !TestNGClassFinder.isTestNGClass( testSet.getTestClass(), annotationFinder ) )
+ {
+ xmlTest.setJUnit( true );
+ }
+ }
+
+ private void executeTestNG( XmlSuite suite, ReporterManager reporterManager )
+ {
TestNG testNG = new TestNG();
// turn off all TestNG output
testNG.setVerbose( 0 );