I have two different Android devices plugged into the same machine. What I would like to do is to target each device and execute a test on it separately.
Unfortunately, it seems as if I need to unplug one of the devices to run the test each time, because if I don't, I receive the following error:
error: more than one device and emulator
Does anyone know of a work-around for this issue so that I can simply keep both devices plugged in and run my tests?
Effective multi-Android tests involve communication between allocated devices. When developing such tests, you must determine how to establish communication between the allocated devices. The following sections provide three communication examples (however, test developers are free to design other models).
Launch Appium server for each device and then connect to the Appium server from client with http://<HOST_IP>:<APPIUM_PORT>/wd/hub. When working with single host the HOST_IP address is localhost or 127.0. 0.1. In multi-machine setup it is something like 192.168.
You need to set ADB_DEVICE_ARG
environment variable to the serial number of your device as returned by adb devices
.
So to add on to Robert's answer:
$ adb devices
List of devices attached
emulator-5554 device
emulator-5556 device
emulator-5558 device
$ ADB_DEVICE_ARG=emulator-5554;calabash-android run yourapk.apk
If you need to run the same Calabash test at the same time on multiple devices, better run them from separate root folders, or specify the result in different folders so that the results don't get mixed up.
You can specify the targeted device on the adb command with -s
1) Get the device serialNumber by doing
$ adb devices
List of devices attached
emulator-5554 device
emulator-5556 device
emulator-5558 device
2) Pass in the serialNumber into the adb command with -s argument
$ adb -s <serialNumber> <command>
For example
$ adb -s emulator-5556 install helloWorld.apk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With