Appium parallel execution issue with testng.xml


#1

Hello,

i am not able to start multiple appium instances.
My testng, itest listener, class file looks like:

testng.txt (1.6 KB)
retry.txt (1.7 KB)
a.txt (1.3 KB)


#2

Anyone can help with this?


#3

First, let create a class AppiumServer, with FreePort (it will using any free port):

public AppiumDriverLocalService appiumService() {

String appiumJSPath = “/usr/local/lib/node_modules/appium/build/lib/main.js”;
AppiumServiceBuilder builder = new AppiumServiceBuilder()
.withAppiumJS(new File(appiumJSPath))
.withIPAddress(“0.0.0.0”)
.usingAnyFreePort()
.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
.withArgument(GeneralServerFlag.LOG_LEVEL, “error”);
AppiumDriverLocalService appiumService = builder.build();
appiumService.start();

Log.println("[Appium] started on " + appiumService.getUrl());

return appiumService;
}

Second, create Driver:

driver = new IOSDriver(AppiumServer.shared().appiumService().getUrl(),capabilities);

This will help you start multiple appium with multiple port. :slight_smile: