Having a problem when running 2 devices simultaneously

I am currently using the following:

TestNG 6.14.3

Cucumber

Java-client - 6.1.0

The issue is that when executing the scenario’s using the testng.xml. The first device completes followed by the second device. It does not run simultaneously ( Parallelly).

<?xml version= *"1.0"* encoding= *"UTF-8"* ?>

<suite name= “BDD Test Suite” parallel= “methods” thread-count= “2” >

<test name= “Device 1” >

<parameter name= “url” value= “0.0.0.0” />

<parameter name= “port” value= “4734” />

<parameter name= “device” value= “ZY223B6K32” />

<parameter name= “deviceName” value= “androidOne” />

<class name= “com.audify.runner.CukeRunner” >

<test name= “Device 2” >

<parameter name= “url” value= “127.0.0.1” />

<parameter name= “port” value= “4723” />

<parameter name= “device” value= “32006074f05165af” />

<parameter name= “deviceName” value= “MotoG4” />

<class name= “com.audify.runner.CukeRunner” >

Do let me know if I am missing anything.

1 Like

if you get answer please share.

<suite name= “BDD Test Suite” parallel= “methods” thread-count= “2” >

change methods to classes.

@chetan_thummar parallel by test looks better here.

https://testng.org/doc/documentation-main.html#parallel-tests

1 Like

Thanks @Aleksei. i will go through that link. i need your guidence. can i have your skype ID?

Thanks @Aleksei. The I have used all the cases specified in the link. Still the issue persists. Please could you provide me your Skype ID so that I could show you the issue.

Thanks for replying. I have done that as well. Getting the same issue.

@SIJO_JOHN

  1. I believe your test XML should look like:
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="BDD Test Suite" parallel="tests" thread-count="2">
    <test name="Device 1">
        <parameter name="url" value="0.0.0.0"/>
        <parameter name="port" value="4734"/>
        <parameter name="device" value="ZY223B6K32"/>
        <parameter name="deviceName" value="androidOne"/>
        <classes>
            <class name="com.audify.runner.CukeRunner">
            </class>
        </classes>
    </test>
    <test name="Device 2">
        <parameter name="url" value="127.0.0.1"/>
        <parameter name="port" value="4723"/>
        <parameter name="device" value="32006074f05165af"/>
        <parameter name="deviceName" value="MotoG4"/>
        <classes>
            <class name="com.audify.runner.CukeRunner">
            </class>
        </classes>
    </test>
</suite>
  1. if it is and still does not work replace “CukeRunner” with some test class e.g.:
package com.xxx.tests;

import org.testng.annotations.Test;

public class myTest_01 {

    @Test
    public void myTest() {
        Long threadID = Thread.currentThread().getId();
        System.out.println("myTest() " + threadID + ": Start");
        try {
            Thread.sleep(5000); // 5 sec
        } catch (Exception e) {
            // ignore
        }
        System.out.println("myTest() " + threadID + ": End");
    }
}

now run it and check they started simultaneously. For me output was:

myTest() 11: Start
myTest() 12: Start
myTest() 11: End
myTest() 12: End

===============================================
BDD Test Suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================

Thanks for replying @Aleksei. Can we connect so that I could show you the issue.
Email Id: [email protected]

Sent personal message

Hey @Aleksei,

I have pinged you.

The issue would be possibly due to some capabilities that you could be missing, you need to be sure to set systemPort on every android emulator/device.