0

I am not sure if this is a problem with the latest test-ng version, or it was there earlier too (never ran tests in parallel tbh), but. I configured my testng.xml file to run tests in parallel, it kinda doesn't work. Based on the thread-count specified, it launches parallel webdriver instances though, but the driver tries to execute everything on the latest instances of the webdriver.

This is how the beginning of my testng.xml looks like-

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

<suite name="Parallel Tests" configfailurepolicy="continue" parallel="tests" thread-count="5">

so now what for a login test class(with 5 login tests), this launches 5 browser windows, goes to the login URL, and enters credentials on the latest browser window session 5 times!

I am initializing the webdriver in my TestBase.class. And every other class inherits this. Here's the piece of code where I am initializing the webdriver-

public void initialize() {

        browserName = prop.getProperty("browser", "chrome");
        browserMode = prop.getProperty("browser_mode", "start-maximized");

        System.out.println("Launching the browser...");
        if(browserName.equalsIgnoreCase("chrome")) {
            WebDriverManager.chromedriver().setup();
            ChromeOptions options = new ChromeOptions();
            options.addArguments("--"+browserMode);
            driver = new ChromeDriver(options);
        }
}

I am certainly doing something wrong, couldn't figure out what!? Anyone else faced/facing this?

Zeeni
  • 1
  • 3

0 Answers0