Mobile Application testing with Appium

Introduction to Mobile Application Testing

In the fast growing world, the mobile phone is not only a device to make and receive telephone calls but also a multipurpose personal gadget. There are more technological improvement and the propagation on mobile devices with different Operating Systems like Apple iOS, Android, Windows Phone, Blackberry, and Symbian etc. In the fast growing world, there are new challenges for hardware manufactures to stay in the competition.

Mobile application testing is a process by which application software developed for hand held mobile devices is tested for its functionality, usability and consistency.

Mobile application testing can be automated or manual type of testing.

Mobile applications either come pre-installed or can be installed from mobile software distribution platforms. Mobile devices have witnessed a phenomenal growth in the past few years.

Key Challenges in Mobile Application Testing

Variety of Mobile Devices

Diversity in Mobile Platforms/OSes

Device Availability:.

Mobile network operators

Scripting

Choosing how to test

Types of Mobile Application Testing

Functional Testing

Performance Testing

Memory Leakage Testing

Interrupt Testing

Usability testing

Installation testing

Certification Testing

Security Testing

Ten Open Source Mobile Test Automation Tools.

Mobile Test Tools – A collection of the best open source mobile test automation tools than you can use to test mobile apps and websites on mobile devices.

Appium (Android and iOS)

Calabash (Android and iOS)

Frank (iOS)

Monkey Talk (Android and iOS)

iOS UI Automation (iOS)

Robotium (Android)

iOS-driver (iOS)

UI Automator (Android)

KeepItFunctional (iOS)

Selendroid (Android)

What is Selenium?

Selenium is an open source test automation framework that supports cross browser test automation. Selenium supports perl, php, python, objective-c, java, Microsoft.net, ruby, and more. It is not a tool with a user interface. You have to code your tests. You also need a programming language to use it specifically.

Appium is developed on few key philosophy points : 1. Should not have to recompile your app to automate it. 2. Should not be locked into a specific language or framework. 3. Should be open source and 4. Should not reinvent the wheel when it comes to automation APIs.

Also there are other advantages like no source code is needed to test app as you can test it directly, also you can engage built in apps like camera, calendar etc in your test script if required.

Limitations of Appium

There are few limitations in appium right now.

For Android, No Support for Android API level < 17.

Script execution is very slow on IOS platform.

Gestures support is limited.

No support for Toast messages.

Appium’s Architecture

Appium is an HTTP server written in node.js, which creates and handles multiple WebDriver sessions for different platforms like iOS and Android.

Appium starts a “test case” on the device that spawns a server and listens for proxied commands from the main Appium server. It is almost same as Selenium server, which perceives http requests from selenium client libraries, and it handles those requests in different ways depending upon the platforms. Each vendor like iOS and Android have a different way and mechanism to run a test case on the device so Appium kind of hacks in to it and run this test case after listening commands from appium server.

How Appium works in iOS?

In iOS, Appium works in these below given steps as shown in the above picture

Appium Server then creates a automation session for the client and also checks the desired capabilities of client and connects with respective vendor-provided frameworks like Splendored/UIAutomator (based on android versions)

Vendor-provided frameworks will then communicate with bootstrap.jar which is running in Emulator/Real device for performing client operations

jar act as a TCP server to perform action on our AUT (Application Under Test)

Connect Android Device with PC In USB Debugging Mode To Run Appium Test

You need to connect real android device with PC in USB debugging mode in order to run android app automation tests in real android device using appium

Enable Developer Option In Android Device

Previously if you have not enabled "developer options" in your android device then once you need to enable it in order to switch device in USB debugging mode. Otherwise, you can not access USB debugging mode in your device.

Verify Developer Option Is Enabled?

To check Developer Option is enabled or not,

Go to Settings.

Check if there is any option like "Developer Option"?

If Developer Option is enabled then it will display there. Otherwise follow the steps given bellow to enable it.

Enable Developer Option

To enable Developer Option in android device,

Go to Settings.

Scroll down to bottom and tap on About Phone.

Scroll down bottom again on About Phone screen. You will see option Build number.

Tap seven times on Build numberoption one by one. After 3 tap, It will start showing you message like.. "You are now 2 steps away from being a developer" as shown in bellow image.

After 7 times Build numberoption tap, It will show you message "You are now a developer!" as shown in bellow image.

Now go back to Settingsand scroll down bottom.

You will see option Developer Optionsabove About Phone as shown in bellow image.

Connect Device with PC and Start USB Debugging Mode

Note: Let me warn you before enabling USB debugging mode in your android device. Enable USB debugging only when you need it. Leaving it enabled all the time is kind of a security risk as it allows high-level access to your android device. So disable it immediately when you have not any usage of it.

To start USB Debugging mode,

Connect your device with PC using USB cable.

Go to Settings -> Developer options.

There will be option USB debuggingwith check box. Check it.

It will ask you to "Allow USB debugging?". Tap on OK.

It will enable USB debugging mode for your android device.

Verify Device Connected Properly With PC

To verify device is connected properly with PC with USB debugging mode,

Open command prompt in your PC.

Run command ADB devices.

It will show you list of connected devices with your PC. If not display, any device in list that means there is some issue with device connection or USB debugging mode is not enabled properly.

How to Locate Element using UIAutomatorViewer

“UIautomatorviewer" is a GUI tool to scan and analyze the UI components of an android application. With "UIautomatorviewer", you can inspect the UI of an android application in order to find out the hierarchy and view different properties (id, text…) of the element.

"Uiautomatorviewer" is a part of the Android SDK manager and will be accessible once you install the sdk manager. Download and install Android SDK manger from

Once Android SDK installed, navigate to link c:\users\\AppData\Local\Android\sdk\tools you'll notice a batch file with name 'uiautomatorviewer.bat'. Double click on it to launch "Uiautomatorviewer" GUI

Outline/structure of the Session

*Introduction to mobile testing in general (iOS and Android tools available today)

* Introduction to Appium and Selenium on mobile

* Demonstration of familiar functionality from web driver, on mobile

* Discussion of the ways in which the mobile testing challenges

* Discussion of Selenium moving forward to accomodate this new use

Learning Outcome

At the end of this session the audience will understand how Appium allows them to use the power of Selenium to drive mobile devices easily and robustly. They will have learned the ways in which mobile testing can move past the manual phase it generally is in, and into a phase of automated testing as one would expect in web testing.

They will also learn about the ways in which the Selenium protocol was used, and eventually extended, in order to account for testing on mobile devices. This is of interest first for a full understand of the tools at hand, and also for those interested in adding functionality for other domains of use.