Skip to content

Commit

Permalink
[SUREFIRE-2075] Only set thread count if spec'd
Browse files Browse the repository at this point in the history
  • Loading branch information
sbabcoc committed Apr 25, 2022
1 parent 2657a32 commit f3fd04b
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.testng.TestNG;
import org.testng.xml.XmlSuite;

import static java.lang.Integer.parseInt;
import static org.apache.maven.surefire.api.booter.ProviderParameterNames.PARALLEL_PROP;
import static org.apache.maven.surefire.api.booter.ProviderParameterNames.THREADCOUNT_PROP;
import static org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.loadListenerClasses;
Expand Down Expand Up @@ -68,9 +67,19 @@ public void configure( XmlSuite suite, Map<String, String> options )
protected void configureThreadCount( XmlSuite suite, Map<String, String> options )
throws TestSetFailedException
{
String threadCountAsString = options.get( THREADCOUNT_PROP );
int threadCount = threadCountAsString == null ? 1 : parseInt( threadCountAsString );
suite.setThreadCount( threadCount );
String threadCount = options.get( THREADCOUNT_PROP );
if ( threadCount != null )
{
try
{
suite.setThreadCount( Integer.parseInt( threadCount ) );

}
catch ( NumberFormatException e )
{
throw new TestSetFailedException( "Non-integer TestNG [threadcount] setting: " + threadCount, e );
}
}
}

protected void configureParallel( XmlSuite suite, Map<String, String> options )
Expand Down

0 comments on commit f3fd04b

Please sign in to comment.