1

Reusing of threads is probably not quite the right terminology, however I am running a test automation setup that uses <threadCount> from maven surefire in order to run my testNG test suites. the problem is that:

the tests are running and opening a new browser until the number of tests to run is greater than the specified threadCount. For example, if I have 10 tests in the run and specify 7 threads, I will have 7 browsers launch originally, however instead of waiting until these are closed to launch another 3, it will re-use 3 of the 7 browsers to execute the next tests.

How can I have it wait for the 7 to finish in this instance, then launch up another 3 browsers brand new, without reusing the same browser instance.

Scaling this up will become non-viable, if i have for example 100 tests to run and using 10 threads, I will get 90 tests re-ran in the origin 10 browser instances.

  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>${maven.surefire.version}</version>
  <configuration>
     <parallel>methods</parallel>
     <threadCount>${thread.count}</threadCount>
      <suiteXmlFiles>   

here is some code used for instiating my drivers:

@BeforeSuite(alwaysRun = true, description = "Driver Instantiation")
public static void instantiateDriverObject() {
    driverFactory = new ThreadLocal<DriverFactory>() {
        @Override
        protected DriverFactory initialValue() {
            DriverFactory driverFactory = new DriverFactory();
            webDriverThreadPool.add(driverFactory);
            return driverFactory;
        }
    };
}
symon
  • 670
  • 1
  • 7
  • 20

0 Answers0