We have been offering Mobile Selenium Testing through our Selenium grid for a couple of months now. This weekend we optimized the Android emulator and we added new mobile devices: HTC Desire, Nexus One and Nexus S.
The Android Emulator has been notorious for being slow to start up, which is very inconvenient when you want to run tests against it.
The reason it’s slow, is because the Android emulator uses Qemu, which is a program that emulates ARM code (the code used by Android).
On our Ubuntu VMs we previously used the default ARM emulator to start up the Android emulator.
These past few days we took a different approach and we now run on the x86 emulator, which is significantly faster in terms of starting and using the emulator.
The x86 emulator is included in the Android SDK. Using it means you need to specify Intel’s x86 image as a target system image when creating an AVD (Android Virtual Device). Together with some tweaking of the AVD’s memory (RAM), you can make the emulator quite a bit faster.
Since Qemu can only use 1 CPU core, it is recommended to get the fastest CPU possible.
Another important tip we’d like to share is to use the emulator’s snapshot feature, which saves the emulator’s state on disk.
When you later start the emulator again, it will check for a snapshot image and use that as a starting point, meaning you can use it as a hibernation feature. Booting up the emulator will make sure you start off right where you stopped before.
Once you get to this point, you simply upload and install the WebDriver apk and save the snapshot. Next time you start the emulator, it will be a lot faster. To keep the snapshot clean, use the -no-snapshot-save option. This will ensure the emulator will always start up with the WebDriver app ready to be used. Should the app crash during a test, it will not be saved to the snapshot, preventing a “corrupted” snapshot.
We also added a capability which you can pass along with your test, called “landscape”. When specified, it will run the emulator in landscape mode. If you do not specify this capability, we’ll always run the emulator in portrait mode.
Our tunnel works seamlessly together with the emulator, which means you can test websites residing on your internal work right on the Android emulator.
This works by setting Qemu’s proxy setting before starting the emulator. The only issue we discovered there is that Qemu’s proxy code only seems to proxy port 80. We will work on patching the Qemu code to accept different ports, but at first glance compiling it seems to be quite a challenge.
Right now we still use Ice Cream Sandwich, since a Jelly Beans Intel x86 image was not yet available. When available, we will update to Jelly Beans.
Together with Android testing, we also have been providing iOS (iPhone/iPad) testing for a couple of months now.
iOS testing is also integrated with our tunnel, we provide screenshots and a video of your test and landscape mode is also supported.
Please let us know which other mobile devices you would like to run Selenium tests on.