Starting appium programmatically, tests are running on my device but one after one instead of both at the same time.
Here is my code:
@BeforeClass(alwaysRun = true)
@Parameters({“port”, “device”,“url”,“bpport”})
public void setUp(int port, String device,String url,String bpport) throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
adb = new ADB(device);
service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(newFile("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withIPAddress(url)
.usingPort(port));
service.start();
server = service.getUrl().toString();
caps.setCapability(“deviceName”, device);
caps.setCapability(MobileCapabilityType.UDID, device);
caps.setCapability(“platformName”, “android”);
caps.setCapability(“app”, “/Users/admin/Downloads/xxx.apk”);
caps.setCapability(“appWaitActivity”, “XXXXActivity”);
caps.setCapability(“appWaitActivity”, “XXXActivity”);
caps.setCapability(“appPackage”, “com.xxx”);
driver = new AndroidDriver<>(new URL(server),caps);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
and the testng.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite" parallel="methods" thread-count="2" >
<test name="test on zte">
<parameter name = "port" value="4723" />
<parameter name = "device" value="ffc64100" />
<parameter name = "url" value="127.0.0.1" />
<classes>
<class name = "com.test"/>
</classes>
</test>
<test name="test run on vivo">
<parameter name = "port" value="4734" />
<parameter name = "device" value="df89e0b3" />
<parameter name = "url" value="127.0.0.1" />
<classes>
<class name="com.test">
</class>
</classes>
</test>
</suite>
I want to run the test on both of the devices at the same time and not one by one, what am I missing?