it seems that running an Android Test requires that a device or emulator is present. even this article: http://code.google.com/p/the-missing-android-xml-junit-test-runner/ requires it.
does anyone able to setup Android Tests in a CI server? kindly enlighten me 开发者_JAVA技巧on how to do the setup.
thanks!
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 :)
You might want to take a look at this Jenkins plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Android+Emulator+Plugin
We've been using it with reasonable success.
精彩评论