Running appium tests parallel in 2 ios devices

I want to run the appium tests for my app parallelly in two iOS(iPhone 6s and iPhone 8+) devices.

My app basically needs to launch and then go to chrome for creating a new user account and then come back to my app and run the tests.

I am able to create 2 appium server instances, but how do I pass UDID of two devices in my code? I tried passing the UDID in testng.xml file, but of no use.

Appium version in use - 1.10.1
JDK - 11.0.2
MacOS - 10.14.2(macOS Mojave)

Hi,
You can set the Device UUID while building the capabilities.
capabilities.setCapability(MobileCapabilityType.UDID, “DEVIEC UUID”);

Is it possible to pass 2 UDIDs in the function and it picks one thats active?

No, even if you add 2 UUID’s it will take the last one which you have set at Capabilities.

Build Capabilities as per your Device UUID before starting the session.

Okay.
I could fix it at one place for launching my app. But I have a function that launches the chrome app later where in checks for the capabilities, which is where I want the code to pick the UDID of the device that launches chrome app.
Is is possible for us to be able to get the UDID of the device at run time?

Thanks

Yes, we can.
Use idevice_id -l command. This will list out the no.of connected devices which are connected to your machine.

Thanks.
Could setup two devices for parallel testing.
The new found issue is that one of the device(A) launches chrome app and I expect the same to be happening with other device(B), but the device A launches chrome app again rather than device B.
Anything that I’m missing?

I’m passing udid,platform,wdaport parameters through testng.xml file.