3

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();
        }

}
eugene.polschikov
  • 7,254
  • 2
  • 31
  • 44
  • are you connecting the two devices to single machine? – Murthi Sep 07 '17 at 13:03
  • Please show us the AppiumDriver instantiation part and also a trimmed version of both of your tests, so as to help us get an idea of what is going wrong in your case. – Krishnan Mahadevan Sep 07 '17 at 13:45
  • @Murthi: Yes, we are connecting two devices to single machine through usb cables – Saisree Bhargavi Alamuru Sep 08 '17 at 06:00
  • @Krishnan Mahadevan: Actually we are exporting the seetest automation script to selenium java and then trying to parallely execute that script using TESTNG. Below is the seetest script code in selenium: – Saisree Bhargavi Alamuru Sep 08 '17 at 06:04
  • Since you are running the entire class use `parallel="classes"` instead `parallel="methods"` for more info http://testng.org/doc/documentation-main.html#parallel-running check this out. – Sudha Velan Sep 08 '17 at 07:50

0 Answers0