For mobile application testing, automated testing is somewhat behind web app automated testing. Basically, there are two ways to automate mobile application testing:
1. Use commercial automation tools, like QTP, with its plugin for mobile applications. But, these kinds of tools interact with the elements defined by them (or the plugin) rather than interacting with the native applications. For this reason, we prefer Selenium for web app automated testing. For mobile application automated testing, we also want a tool like selenium that interacts with the native application. Another reason we don’t like most commercial tools is that the automation at the UI level is too difficult to maintain, especially for agile development which often has changing requirements (features) combined with quick deployment and testing.
2. Use the ‘official’ tools from the OS provider, such as Robotium for Android and XCode instrument for iOS. But Robotium will not support iOS, and instrument will not support Android.
Luckily, Appium which recently came out, helps to solve this problem. Appium, using Selenium Web Driver, can interact with native applications across Android and iOS. Also, since web driver supports different development languages, you can use your preferred language to develop the automation scripts. Is Appium difficult to use? We found it was easy to understand if you have basic development knowledge.
1. Setting up Appium is quite easy. As it is based on nodejs, you need to install node on your machine first. You can easily find the material for installing node on the internet. Best to setup the environment on a Mac in order to test on both iOS and Android. Appium on Linux cannot be used to test iOS applications. For Windows, there is a Beta build for Windows with limited help documentation, and its reliability is questionable.
2. When Appium is setup (don’t forget to install ‘wd’, which is also stated in the official guide), you can start the Appium server. It will listen to port 4723 for the actions later. You can read server.js in appium folder for more information.
3. Then you can try simplest.js in the sample code folder (I use nodejs as an example. You can choose the example according to your preferred language). The script will first initial a wd variable (wd is the short for WebDriver) which locates port 4723. And then it will use the init function to initialize a device. If you specify iOS in this init function, it will use Instruments to interact with your iOS application. The code for Instruments are in a folder named instruments in Appium. Of course, if you specify Android, you need to read the code in the Android folder. Then, any action taken by the wd variable will be captured by the Appium server and transferred to a visible action on virtual devices.
After following the steps above, you can now write your own test scripts to test your iOS or Android applications. For mobile application automated testing, we are really excited about using and learning more about Appium because it drives the native application and supports both iOS and Android.