Pioneering Appium with Ruby for Mobile Test Automation, Part 1: Required Software
Appium is a single link in the chain called ‘mobile test automation’. Yet it has much attention focused on it. I’ve got it to work with my old Samsung Galaxy S4 phone (below). Interested?
Firstly, what’s Appium? It’s a mobile test automation tool which appeared around 2010 and has created quite a buzz since. Appium could make manual mobile testing history but at the same time it doesn’t seem to get stable roots. In this dummy-proof series, I’ll describe my experience in setting up the testing chain from the business-readable Gherkin script using Ruby code to ultimately make test automation work on a real mobile device.
This initial post focuses on the software required for use in a Ruby-based Appium setup for Windows intended to test Android applications on a real device. This guide is aimed at people who are fairly new to mobile test automation and its challenging setup.
To be able to start test automation with Appium, all the links in the chain needs to be in place. The following pieces of software are required:
We’re going to automate using Ruby, so you’ll need to install its software first. Make sure to pick Ruby 2.3.3, as the Ruby DevKit is not available in newer versions. The Ruby DevKit is required here because it has a feature that allows you to build native extensions later on. Put the DevKit in the Ruby directory for later use.
Don’t forget to set up your system environment variables to make sure the separate links in the chain are able to find each other. Add both the Ruby location, for example: C:\Ruby\bin, and the DevKit location, for example: C:\Ruby\devkit\bin, to the existing Path variable.
Java Development Kit
Next up is the Java Development Kit. Most likely the latest version will do. Once again, don’t forget to set your system environment variables. A new variable called JAVA_HOME could be created containing the location of the Java installation. For example: C:\Program Files\Java\jdk. Value %JAVA_HOME%\bin then has to be added to the Path variable.
Android Software Development Kit
We’re building an environment capable of testing software on an Android device. To do this the Android Software Development Kit is required. The easiest way to get the kit is through installing the Android Studio. The latest version should do the trick.
Remember: eat your vegetables and set your environment variables. ANDROID_HOME should be created containing the path to your Android Software Development Kit location, for example: C:\Android\sdk. To the Path variable we need to add %ANDROID_HOME%\bin and %ANDROID_HOME%\platform-tools so we can use Android specific features everywhere.
Apache Maven and Apache Ant
Two neat supporting tools are necessary to make this project a success: Apache Maven and Apache Ant. Download the software and put it in a convenient directory. Both directories need to be added to your Path System Environment Variable. For example: C:\apache\maven\bin and C:\apache\ant\bin. For my setup I’m using the latest versions.
We need the Java libraries bundled in Node.js too. Luckily they made an installer for this. You can simply download and install the latest software from their website.
We’ve finally arrived at the closing link in the chain: Appium. You can just download and install the software from the site. I’m running client version 1.2.0 beta 2 (containing server version 1.6.5). While this release has a lot of neat new features (like iOS 10 support) it doesn’t come with an inspector tool.
If your automation efforts require you to identify the building blocks of your application, then you need to download Appium server version 1.5 or lower. This installation can coexist alongside the latest version as long as you don’t run them at the same time. I’m currently using Appium server 1.4 for inspecting the apps on my phone.
That brings us to the end of the first part of the series. More posts about Appium development will be following soon. Stay tuned.
Ruby 2.3.3 + Ruby DevKit
Java Development Kit 8u144
Android Studio 162.4069837
Apache Maven 3.5.0 and Apache Ant 1.10.1
Appium Server 1.4 + Inspector