I am not able to run same test on two android devices simultaneously using Appium

I am not able to run same test on two android devices simultaneously using Appium.

I am following same steps mentioned at http://toolsqa.com/mobile-automation/appium/appium-parallel-execution-using-testng/ still my tests are executing one after another on Android device and Emulator.

This is my TestNG.xml :

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”>
<suite name=”Suite” thread-count=”2″ parallel=”tests”>
<test name=”Test1″>
<parameter name=”UDID” value=”HNB33U0D” />
<parameter name=”PORT” value=”4723″ />
<classes>
<class name=”AppiumMaven.AppiumM.AppTest”/>
</classes>
</test> <!– Test –>
<test name=”Test2″>
<parameter name=”UDID” value=”emulator-5554″ />
<parameter name=”PORT” value=”1234″ />
<classes>
<class name=”AppiumMaven.AppiumM.AppTest”/>
</classes>
</test> <!– Test –>
</suite> <!– Suite –>

 

This is my Test :

public class AppTest
{
private AndroidDriver<AndroidElement> driver;

@Parameters({“UDID”,”PORT”})
@BeforeMethod
public void setCapabilities(String UDID,int PORT) throws MalformedURLException
{

DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “android”);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, “android”);
cap.setCapability(“appPackage”, “com.aaahome”);
cap.setCapability(“appActivity”, “SplashScreen”);
cap.setCapability(“autoGrantPermissions”, true);
cap.setCapability(MobileCapabilityType.UDID, UDID);
driver=new AndroidDriver<AndroidElement>(new URL(“http://127.0.0.1:”+PORT+”/wd/hub”),cap);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}

@Test
public void Test1() throws InterruptedException
{

}

@AfterMethod
public void quitDriver()
{
driver.quit();
}
}

Default Asked on May 20, 2018 in Appium.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.