Appium-Grid-Android-Parallel execution

Hi,

I have a selenium grid setup with couple of real mobile devices(android). I have 2 nodeconfig json file for each of the devices and i have launched 2 appium servers. I can run my tests on both the devices without any issue but i have couple of problems here.

  • When i run the command with deviceName and device capabilities (both with the value what adb devices returns) the tests always pick up the first device listed in adb

  • I would like to know what happens when multiple tests are triggered and how do i manage manage common capabilities for my grid so that if i want to run on android the test can pick which device is free at that moment. For example 2 tests running from 2 different computers, when 1 test uses a device. I want other test to utilize the second device instead of waiting for the first one.

Could you please clarify my queries ?

Note: I am cucumber for testing. and if i want to run tests parallel need to trigger 2 instances of my tests from terminal.