I run in parallel with a service start, stop at before and after suite, but when calling driver.get().quit function in the first thread, both devices quit driver and show error a session is either terminated or not started appium parallel

Parallel 2 device
@BeforeSuite(alwaysRun=true)
public void setService(){
    startServer();
}    

AfterTest
public static void afterTest() {
if (DriverManager.getDriver() != null) {
DriverManager.quit();
}
}
@AfterSuite
public void closeServer(){
stopServer();
}

Show more code.
Most possible reason you use some static variables…

BTW 2 phones = you need 2 appium servers running each on unique ports.

1 Like


I also tried to initialize 2 appiumlocalservice at the same time at beforeTest but 2 threads only get 1 port so it fails, and I haven’t been able to handle that case yet.

Start from removing word “static” from all variables and functions

1 Like