Unit Testing an Android App on Bamboo, Hudson, or any CI Server

It seems like testing on Android requires a device or emulator. even in this article: http://code.google.com/p/the-missing-android-xml-junit-test-runner/ requires this.

Can anyone set up Android Tests on a CI server? kindly enlighten me on how to set up.

thanks!

+6
source share
2 answers

Unfortunately, I have not finished this task. But I think I'm close to that. We use Jenkins as an integration server.

Android emulator has a nice option

-no-window 

I managed to run the emulator with this option on our Ubuntu server without an X server.

So, I am going to follow these steps:

  • Create a dedicated AVD to run the tests (not sure about their number, but we start with one AVD and one Android project and one task :))
  • The first step in the build is to run the emulator with -no-window
  • The second step is to install application packages using adb. Here is one of the great features of the adb install command: it will complete when the installation is complete. Therefore, we do not worry about the long start of the emulator.
  • And the last step - do the tests using

    adb shell am instrument

There is also the task of collecting JUnit reports. I haven't touched it yet ... But I'm sure it is possible :)

+6
source

You can take a look at this Jenkins plugin:

https://wiki.jenkins-ci.org/display/JENKINS/Android+Emulator+Plugin

We have used it with reasonable success.

+4
source

Source: https://habr.com/ru/post/892205/


All Articles