Mobile parallel execution with Selenium and Testng

297 views Asked by At

I'm trying to execute one test script on two android devices simultaneously using Selenium and TestNG. But I'm unable to achieve it. The test script executes first on one device and then starts executing on other android device.Here is the TestNg.xml which i have used:

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
        <suite name="Parallel test suite" parallel="methods" thread-count="2">
        <test name="Regression 1">
          <parameter name="devname" value="adb:SM-G900H" />
            <classes>
              <class name="Parallel.EribankTetsng"/>
            </classes>
          </test>
          <test name="Regression 2">
          <parameter name="devname" value="adb:GT-I9300" />
            <classes>
              <class name="Parallel.EribankTetsng"/>
            </classes>
          </test>
        </suite>

EribankTestng.java: The below is the test script which is export from seetest automation to selenium. we are connecting two android devices to same machine and trying to execute parallely using Testng. only after the execution is completed one device, the execution is getting started on the second device.

public class EribankTetsng
{
    private String host = "localhost";
    private int port = 8889;
    private String projectBaseDirectory = "D:\\Vijaya Seetest";
    protected Client client = null;  

    @BeforeTest
        public void setUp(){
            client = new Client(host, port, true);
            client.setProjectBaseDirectory(projectBaseDirectory);
            client.setReporter("xml", "reports", "LoginEribank");
        }   

        @Test(groups = {"seetest"})
        @Parameters("devname")
        public void testLoginEribank(String devname){
            client.setDevice(devname);
            client.launch("com.experitest.ExperiBank/.LoginActivity", true, false);
            client.elementSendText("Eribank", "Username", 0, "company");
            client.elementSendText("Eribank", "passwordTextField", 0, "company");
            client.click("Eribank", "Login", 0, 1);
            client.click("Eribank", "Logout", 0, 1);
        }

        @AfterTest
        public void tearDown(){
            client.generateReport(false);
            client.releaseClient();
        }

}
0

There are 0 answers