Unfortunately I have not finished this task yet. But think I'm close to it.
We use Jenkins as an integration server.
Android emulator has a nice option
-no-window
I managed to run emulator with this option on our Ubuntu server without any X-server.
So I'm going to implement the following steps:
- Create a dedicated AVD for running tests (not sure about their count, but we start with one AVD and one Android project and one job :) )
- The first build step will be to run an emulator with -no-window
- The second step - install application packages using adb. Here is one pretty feature of adb install command: it will finish after installation is completed only. So we don't worry about long emulator startup.
And the last step - run tests using
adb shell am instrument
There is also a task of gathering JUnit reports. I have not touched it yet... But I'm sure it's possible :)