I spent some time today and yesterday understanding the process of how Selenium on Android works, and well getting some basic tests actually running on Android. The Selenium Android Driver can be found here http://code.google.com/p/selenium/downloads/list with quite a good how-to on getting things up and running http://code.google.com/p/selenium/wiki/AndroidDriver.
Before continuing this is no tutorial but rather my thoughts on how the process went, so now that we have that out the way let me continue: On a fresh install of Ubuntu 12.04 64 bit I went about setting up the Android SDK according to the instructions here http://developer.android.com/sdk/installing/installing-adt.html and everything went smoothly. The only issue I had here was to install an extra package that can be found in the standard repo's with apt-get install ia32-libs.That got everything chugging along nicely. Next up was setting up the Eclipse IDE for testing with Selenium on Android.
I downloaded three packages namely selenium-java-2.33.0.zip, selenium-server-standalone-2.33.0.jar and android-server-2.32.0.apk and added the necessary JAR files to my project in Eclipse. Next up I installed the android-server-2.32.0.apk via the adb tool which installed fine on a Nexus 10 running Android 4.3:
Once the driver was started and the device could be seen by running adb devices -L it was just a matter of running the test code in Eclipse to get the first result. The first few times I did try however I did come across a few problems as seen in the following screenshot:
Rather annoying. The problem here is that sometimes the test case was working and other times it was failing. I might add that the Android Webdriver crashed a few times too, irrespective if I was running a test case or not. I need to activate a logger for this to get a better understanding of exactly what is happening. Getting back to the actual tests (when they worked) we can see the following:
So great it works!
But is it really so great?
- The problem here is that we have to automate this somehow
- How good is the Webdriver's built in browser?
I might be completely off topic here but I remeber in previous versions of Android there was a default browser which has since been replaced by Chrome so is this even valid anymore? Firefox is also available for Android so would it make more sense to actually run the test cases in these mobile browsers? I am rather unsure. In addition to this I am also not sure how well all of this can be automated, like starting Eclipse, running the test cases, connecting an actual physical device like a tablet to a computer and repeating this once a night or once a week. It seems a little messy. Using the Android Emulator is an option and can be run from the command line but is the emulator enough. These are still the questions I am not sure of if I want to reliably test eGov services on mobile devices, at least on Android for the time being...
I will spend the next few days now looking at writing more complicated tests and seeing how all of this can be automated in the easiesr way. More to come soon.