I want to run an Android Robotium test on two devices simultaneosly. I couldn't find any solution by now...
To be more precise, I have an application-test.apk wich contains multiple instrumentation classes. I want to run the same test apk, but different test classes on both devices. I know that I can run the tests only in serial mode, with adb.
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.
However, it may be different from executing test scripts on Android and iOS devices because element locators may differ on Android and iOS devices. But a script written for any android or iOS device can be run on all devices with the same OS by changing desired capabilities.
Simply right-click on your project, select 'New' and then 'Other'. Click “Cloud Parallel execution”. Then click “Next” and select the devices in which you want to execute your tests on. All Android or iOS devices available will be listed and can be selected.
Robotium Test cases can be executed on Android Emulator as well as the Real device, we don't need to write any specific configuration code to run Robotium test cases on the Real device. Robotium Can be easily written in the Maven project also, and it can be run through continuous integration tools.
You can use the -s flag to point an adb command to a specific device. This means that you can just open up two terminals and using the -s flag run both different commands and they will both run in parallel. It is obviously then easy to change this into a script to make it a more scaleable solution.
Example time...
You have two devices connected to your machine and two different test classes you want to run (one on each) on running:
adb devices
you see
List of devices attached
SERIALOFDEVICE1 device1
SERIALOFDEVICE2 device2
then using the serials shown you can then run a command:
adb -s SERIALOFDEVICE1 shell am instrument -w -e class com.android.foo.FooTest1 com.android.foo/android.test.InstrumentationTestRunner
adb -s SERIALOFDEVICE2 shell am instrument -w -e class com.android.foo.FooTest2 com.android.foo/android.test.InstrumentationTestRunner
where
com.android.foo.FooTest1
com.android.foo.FooTest2
Are the classes you want to run on each device.
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