Appium – The Mobile Automater

Mobile Application Testing

Mobile technology is at its zenith, impacting the everyday lives of people. Together with customer apps, enterprise apps are evolving as well, improving the productivity of businesses. It is important to build an app with all features and functionalities required by the customer and beneficial to the app user, but what is even more critical is a rigorous mobile application testing before the app is deployed. In this blog, I would be shedding light upon mobile app testing using Appium, the mobile automater.

Before moving on, let’s take a look at the basic types of mobile applications:

Native apps are apps that are present in devices and accessible using the corresponding icons in the home screen. Mobile web apps are apps that access websites on mobile through different browsers. Hybrid apps, on the other hand, are combinations of native apps and mobile web apps.

What makes testing mobile applications more challenging than testing web applications are the following factors:

Different range of mobile devices

Different versions of operating systems

Different mobile network operators

Manually testing the application is simple. It can be done if the build is available in the form of apk (Android Application Package) file for android and ipa (iOS Appstore Package) file for iOS. You just need to follow these simple steps:

Get the apk/ipa file

Download and install it in the device

The installed package then appears as an app along with the installed apps in the device

Click on the application icon (launch icon) to get started

However the manual test process is repetitive and cumbersome. So for regression test cases and for complex scenarios that are time consuming, automation testing is preferred.

What is Appium?

For mobile test automation, Appium is one of the many tools available in market. It is an open source, cross-platform test automation tool for native, hybrid and mobile web apps, tested on simulators, emulators, and real devices.

Appium Architecture

Appium is an HTTP server written in Node.js which creates and handles multiple Web Driver sessions for different platforms like iOS and Android.

An automation session for the client is created by Appium server. It checks the desired capabilities of clients and connects with respective vendor-provided frameworks like Selendroid/UIAutomator (based on Android versions)

UI automator will then communicate with bootstrap.jar running in Emulator/Real device for performing client operations

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

Why Appium?

Due to the use of standard automation APIs on all platforms, you don’t have to recompile your app or modify it in any way.

You can write tests using any WebDriver-compatible language such as Java, Objective-C, JavaScript, PHP, Python, Ruby, C#, or Perl.

You can use any testing framework.

Set up Appium with Eclipse on Windows

Let’s take a look at the steps to set up Appium in Windows for automating an Android application, with the scripting language as Java.

Step 1: Install the Java Development Kit (JDK)

First of all, install JDK (Java Development Kit), which includes JRE plus the development tools for writing as well as running Java programs.

Step 2: Set Up Java Environment Variable Path

To edit the PATH environment variable:

Go to Control Panel -> System and Security -> System -> Click “Advanced system settings”

Switch to Advanced tab -> Environment Variables.

Under System Variables, scroll down to select Path -> Click Edit.

Enter the JDK’s binary directory path

Step 3: Install Android SDK / ADB on Windows

Download android SDK and run the downloaded installer. Follow the on-screen instruction and accept the defaults to complete the installation.

Step 4: Install Android SDK Packages

Go to the folder, where the Android installation was done.

Go to android-sdk folder

Open SDK Manager.

Install the APIs required based on the android version to be used. SDK manager will install all the chosen packages.

Step 5: Set up Android Environment Variable

After you’ve installed the Android SDK Environment Kit in Windows, you must set the ANDROID_HOME environment variable to point to the Android SDK installation directory.

In order to set up ANDROID_HOME Variable:

1) Open the Control Panel -> System or Security –> System; the same thing can be done by right-clicking on My Computer and choosing Properties.

2) Choose ‘Advanced system settings‘.

3) Under the Advanced tab, choose the Environment Variable option.

4) Select New in the System variables.

5) Define the variable name and provide android sdk path

Step 6: Download and Install NodeJs

Step 7: Install Microsoft .net Framework

Step 8: Download and Install Appium Desktop Client

Install the Appium Desktop client. Click on Appium.exe for Windows to download the ‘.exe’ file for Appium. Go with the latest version of Appium. Appiumwill open up, once the installation is done with the below message.

Step 9: Enabling Developer Mode Options on Android Phone or Tablets

Go to Settings -> About Phone -> Scroll down to the bottom again, where you see ‘Build number’. Tap on build number 7 times -> Developer Options -> Tick the USB Debuggingcheck box.

Step 10: Install PdaNet to Connect with Android Device

Step 11: Install Eclipse IDE and Set up a Project

Create new Java Project from File > New > Project

Give your Project name as ‘AppiumTestProject‘. Click on Finish button.

Create a new package under this project -> Create a new class under this package

Once the project settings are done, we can start scripting. The basic part of the script involves defining the desired capabilities, a set of keys and values sent to the Appium server to tell the server what kind of automation session we are interested in starting up.

KEYS

DESCRIPTION

browserName

Name of mobile web browser

appium-version

Version of Appium

platform Version

Mobile OS version

deviceName

Kind of mobile devices to be used

platformName

Kind of mobile OS platform to be used

Look at the sample script for defining desired capabilities:

DesiredCapabilities cap = new DesiredCapabilities();

cap.setCapability(“browserName”, “chrome”);

cap.setCapability(“appium-version”, “1.4.0”);

cap.setCapability(“VERSION”,“5.1.1”);

cap.setCapability(“deviceName”,“ANDROID”);

cap.setCapability(“platformName”,“ANDROID”);

Attach Android device with your system and type adb device command on cmd prompt to verify that the device is attached or not. Launch Appium tool on your machine. Once the Appium is launched run the script written in Eclipse.

What's happening!

ThinkPalm to Attend CES 2018 – Las Vegas, NV!

12 Dec 2018

ThinkPalm Technologies is heading to Las Vegas, Nevada to attend CES 2019, the biggest tech extravaganza of the year organized by the Consumer Technology Association. We would be showcasing our Enterprise, Mobility, Communication, IoT, Cloud and Data Analytics solutions from January 8-11. Are you attending CES? We would love to meet up with you and … Continue reading ThinkPalm to Attend CES 2018 – Las Vegas, NV!→

Catch Us in Action at Mobile World Congress 2018!

16 Feb 2018

We are excited to showcase at Mobile World Congress, Barcelona from February 26th – March 1st, 2018. This year, we would be projecting our might in the Connected Industry, Smart Health and Smart Home IoT domains, along with our communication capabilities, at Hall 8.1 – App Planet Stand 8.1D11.

ThinkPalm to Attend 37th GITEX Tech Week, Dubai!

20 Sep 2017

ThinkPalm will be participating in the GITEX Technology Week, Dubai for the fifth consecutive year. The event, being held from 8th – 12th October, 2017 at Dubai World Trade Centre will have us showcasing our technological expertise in Enterprise Solutions, Mobile App Development, Internet of Things, DevOps, Testing Services, New Product Adaptation, Business Intelligence and … Continue reading ThinkPalm to Attend 37th GITEX Tech Week, Dubai!→

ThinkPalm to Showcase at Safety and Health Expo, 2017

18 May 2017

ThinkPalm will exhibit its enterprise and mobility capabilities at stall no. Q15 – SHE Expo, Excel London from June 20th-22nd. The showstopper exhibits are “Q-Aud” Mobile Audit and Inspection Software and “DocDrive” Document Management Software. Visit http://ubm.io/2qyDPDR for more details.

We'd love to hear from you!

If you'd like to know more about our solutions, please use the contact form below.