2

I am wondering how I can test some functionality on my android application that requires 2 devices. At this level of testing I don't want to mock anything, but I definitely want to keep these tests completely automated. I also want to run these in a cont. integration server.

So for example, given let's say a chat application, I would like to start up 2 emulators, send messages from one to the other and confirm the messages have been sent/received. So how does one start the 2 instrumentation tests at the same time and synchronize them so that the first emulator sends the message and the second one asserts that the message is the expected one?

sakis kaliakoudas
  • 2,039
  • 4
  • 31
  • 51
  • Haven't tried it myself, but check out Arquillian. They seem to have support for multiple instances in the same test container. https://github.com/arquillian/arquillian-droidium/tree/master/tests/droidium-multiple-androids-01 – Qw4z1 Jul 11 '14 at 07:59

1 Answers1

0

If you want to use a network to send your messages it is not possible to test it with the emulators, Refer to this Android Emulator

When you use Bluetooth it is possible:

Under settings of the virtual machine, goto serialports -> Port 1

  1. check Enable serial port
  2. select a port number
  3. then select port mode as disconnected
  4. click ok.

start virtual machine.

Under Devices -> USB Devices -> you can find your laptop bluetooth listed.

issamux
  • 1,336
  • 1
  • 19
  • 35
Solenya
  • 694
  • 6
  • 21
  • I am interested in Automated Instrumentation tests, not manual testing. – sakis kaliakoudas Jul 09 '14 at 13:53
  • How about you use 2 real Android devices (if you really need features only found on actual devices, else you can use emulators of course), and you automate the execution of your test routines using an ADB command line script for both devices, and specifying which test to run using the Intent mechanism? Like so: http://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools – epichorns Jul 14 '14 at 18:14
  • Note that if you also want to start/stop emulator instances and configure stuff via GUI, you can automate that part easily by using GUI manipulation tools... For instance, AutoIt for Windows platforms... Allows you quite a bit of "hackability" power... – epichorns Jul 14 '14 at 18:19