5

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.

Matthieu
  • 16,103
  • 10
  • 59
  • 86
Test123
  • 51
  • 3

1 Answers1

4

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.

Paul Harris
  • 5,769
  • 1
  • 25
  • 41
  • Thank you! I would prefer a much elegant way, but this also seems to do the job. – Test123 Dec 18 '12 at 09:12
  • 1
    I wish there was too, well in fact you can do make it more elegant by putting it into a script as i suggested, for example you could make the script take in all the devices you want to run on and all the sclasses to run and make it do that. As a side note, when you find an answer useful the normal thing to do is to upvote it (press the upvote arrow) i allows people to easily see it was useful or if it answered your question you click the tick mark to accept it as the answer! – Paul Harris Dec 18 '12 at 21:57