Parallel Test execution in two android devices(pixel)

Hello,

I am using two android device (pixel) and i want to run the test simultaneously in both the devices.
Test framework: TestNG
IDE: Eclipse

testing.xml

<?xml version="1.0" encoding="UTF-8"?>
<test name="Pixel">
    <parameter name="udid" value="FA6BA0301266"/>
    <classes>
        <class name="InitialSetup" />
    </classes>
</test>

<test name="PixelXL">
    <parameter name="udid" value="HT74C0209332"/>
    <classes>
        <class name="InitialSetup" />
    </classes>
</test>

build.gradle
apply plugin: ‘java’
apply plugin: ‘maven’
apply plugin: ‘eclipse’

repositories {

 maven { url "https://cloud.experitest.com/repo" }
 maven { url "http://repo.maven.apache.org/maven2" }
 mavenCentral()

}
dependencies {
compile group: ‘com.experitest’, name: ‘appium’, version:‘11.2.32’
}

test{

useTestNG() {
suites ‘testng.xml’
}

}

@Before
dc.setCapability(MobileCapabilityType.PLATFORM, “android”);

after doing all the setup still the test is not executing simultaneously in two devices.
let me know how this issue can be resolved?

@Before is a JUnit annotation and not a TestNG annotation

You should use @BeforeClass or @BeforeTest (depending on your structure)

In general
@BeforeTest runs before teh tag in Test NG
@BeforeClass runs before the tag - or when a class is initiated

Hello Tom,
By using @BeforeTest or @BeforeMethod application is getting installed simultaneously in both the devices.
But the code written in @Test is executing only in single device.

Also i use below "Parameter"annotation for device identification and remove
dc.setCapability(MobileCapabilityType.PLATFORM, “android”);
from @BeforeMethod

@Parameters(“udid”)
public void setUp(String udid) {
dc.setCapability(MobileCapabilityType.UDID, “FA6BA0301266”);
dc.setCapability(MobileCapabilityType.UDID, “HT74C0209332”);
}

Let me know how to resolve it.
Thanks in advance.

Hi

Please share the entire class code

your latest post includes something that I don’t expect to work

@Parameters("udid")
public void setUp(String udid) {
dc.setCapability(MobileCapabilityType.UDID, "FA6BA0301266"); // this should be ignored by frameword
dc.setCapability(MobileCapabilityType.UDID, "HT74C0209332"); // because you are overwriting the capability here
}

Hello Tom,
i am unable to reply as the site shows an error of you cannot add more then 2 users. so sharing the class code with u via mail.

I have reply on the notification mail i have received from you.
If you don’t receive it then If you cud share your mail ID so I can share the class code with you or let me know if there is any other way to share the class code.