appium 2

How to set up the Appium Framework for Android?


This article will describe how to setup the Appium framework for Android device app automation testing. Appium is an open source tool which is used to automate testing for native, hybrid and mobile web. Appium is designed to automate mobile app testing from any language.


Appium goals to automate any mobile application from any languages like Ruby, Python, Java, JavaScript, PHP, C# and any test framework, with full access to back-end APIs and DBs from the test code. You can write your tests with your favorite developer tools using all the programming languages and probably with the Selenium Web Driver API and language-specific client libraries. It is freely distributed open source mobile application and supports Native, Hybrid and Web application testing and provide automation test support to physical devices as well as emulator or simulator both. Appium enables Android automation using Selenium WebDriver. The same WebDriver binding can be used across web and mobile and it supports software test automation on Emulator or Simulator and Physical devices too.

How does it work for Android?

When we execute the test scripts, Appium sends the command to UIAutomator or Selendroid on the basis of the Android version. Here, bootstrap.jar plays the role of a TCP server, which we can use to send the test command in order to perform the action on the Android device using UIAutomator/Selendroid.

Developing quality Android mobile apps for a top android app development company cannot be accomplished without doing foolproof testing and if that testing could be automated, it saves a lot of time and cost to customers. This is where Appium fits best in its class. 


Prerequisite for Appium Setup:
1. Installation of ANDROID SDK (Studio)
2. Installation of JDK (Java Development Kit)
3. Installation of Eclipse
4. Installation of TestNG for Eclipse
5. Installation of Selenium Server JAR
6. Appium Client Library
7. js (Not Required – Whenever Appium server is installed, it by default comes with “Node.exe” & NPM. It’s included in Current version of Appium)
8. Installation of Appium Desktop

Sample Test Case for Appium for Native Android App (Amazon):

1) Launch Appium Node server
2) Create your first test script
3) Execute your first test

Launch Appium Node Server:

1) Appium window should be opened on your machine.
If you have restarted your system then please start Appium by navigates to Appium directory in your system and start Appium by double-clicking Appium.exe file.
structure image

1) Android Icon is for Configuration settings.
2) Settings Icon is for General Settings.
3) Play Icon is for Starting Node server.

1) Click on Android icon to open the configuration of the Appium run. There you need to select the check box of ‘No Reset‘. This will ensure that the Appium will not install or uninstall App on every run.

android settings

2) Click on General Setting icon and make sure that Server Address and Port is populated.


3) Now it’s time to start the Appium server, just click on the Launch Appium Node Server button on the top right corner of Appium window and wait for few seconds. Appium server started and running on your system.


Sample Test Script Creation:

Now you are all set to write your first test script. Create a small test Program for opening an Amazon application on your
device using Appium.


To start the test just select Run > Run As > Java Application Or Right Click on Eclipse code and Click Run As > Java Application. After a few Seconds, Amazon application will be launched on your device. Once the execution is finished, you will see a long list of messages on the Appium console.

Code Explanation:

Import libraries statements:
// Library for Appium drivers

// Library to create the path to APK

// Library used to verify if URL is malformed

// Library used to create URL for the Appium server

// Libraries for configuring Desired Capabilities
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

Path to APK file:

Since the Amazon app apk is stored in the computer and is not already installed on the device what we need to create a file object, which represents the actual apk file on the disk. I placed the folder ‘/Apps/Amazon/‘ which contains the apk file inside the Eclipse project.

// Path to Eclipse project
File classpathRoot = new File(System.getProperty(“user.dir”));

// Path to /Apps -> Amazon
File appDir = new File(classpathRoot, “/Apps/Amazon/”);

// Path to /Apps -> Amazon/Amazon apk file
File app = new File(appDir, “”);

Desired Capabilities:

To be able to test the app on an actual device Desired Capabilities need to be set. Desired Capabilities are a set of keys and values sent to the Appium server to tell the server what kind of automation session we’re interested in starting up. There are also capabilities used to modify the behavior of the server during automation.

// To create an object of Desired Capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();

// Name of the mobile web browser to automate. It should be an empty string, as we are automation an app
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);

// Name of the OS: Android, iOS or FirefoxOS
capabilities.setCapability(“platformName”, “Android”);

// Mobile OS version – My device is running Android 4.4.2
capabilities.setCapability(CapabilityType.VERSION, “4.4.2”);

// Device name: – I am using Micromax A311
capabilities.setCapability(“device name”, “Micromax A311”);

// An absolute local path to the APK file
capabilities.setCapability(“app”, app.getAbsolutePath());

// Java package of the tested Android app
capabilities.setCapability(“apppackage”, “”);
// An activity name for the Android activity you want to run from your package.
capabilities.setCapability(“appactivity”, “”);
// Constructor to initialize driver object with new Url and Capabilities
driver = new AndroidDriver(new URL(“”), capabilities);

Limitations using Appium:

1. Appium does not support testing of Android Version lower than 4.2
2. Limited support for hybrid app testing. e.g.: not possible to test the switching action of application from the web app to native and vice-versa.
3. No support to run Appium Inspector on Microsoft Windows.

The limitations of Appium are limited but it offers more advantages to making it a prime choice for android apps development company to use Appium for automated testing.

About Author:
Author Madan Mohan Singhal is a QA Engineer, currently working with QSS Technosoft Pvt Ltd. He has completed his Bachelor Degree in Information Technology.

About QSS:
QSS Technosoft has a proven track executing enterprise level web and mobile applications for its esteemed customers. The company has a core Testing competency in place for testing Enterprise level applications. The Testing Center of Excellence (TCoE) has experienced and dedicated team of QA engineers who can efficiently perform both manual and automated testing assignments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Hire certified


  • Avg. 6+ Years of Experience.
  • Dedicated Resource on Demand.
  • NDA Protected Terms.
  • Start/Interview within 24 Hours.
  • Flexible Engagement Models.
  • Best code practices.
Start Now!


6 Most Important Factors for a Successful Mobile App!

Every precaution that you take in the development process will help you to be effective in building products that will help you grow and reach your goals. Consider these 6 factors before heading for mobile app development.

Subscribe to our newsletter and stay updated