Appium- Android Native app test automation

I. Getting Ready

First, we need download the java libraries:

  1. Appium java client

    – Go to this link to get it:

  2. Selenium Standalone

    – Go to this link to get:

  3. Google Gson

  4. Download and install Appium

  5. Download and install Android SDK

    Please find more installation detail in google page below:

II. Setup

  1. Appium


  2. 2. Start Android Emulator


III. How it works …

Step1: Open Appium and Start agent and take a while for Appium create server

Figure5.pngStep2: Create Appium Java Project:

  1. Add list of libraries below for project:
  • java-client
  • selenium-server-standalone
  • google-gson
  • Junit4

2. Add new Junit test case like below:

import io.appium.java_client.AppiumDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.util.List;
public class AndroidContactsTest {
    public  AppiumDriver driver; 
    public void setUp() throws Exception {
        // set up appium
        File classpathRoot = new File(System.getProperty("user.dir"));
        File appDir = new File(classpathRoot, "../../../apps/ContactManager");
        File app = new File(appDir, "ContactManager.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("deviceName","Android Emulator");
        capabilities.setCapability("platformVersion", "5.0");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "");
        capabilities.setCapability("appActivity", ".ContactManager");
        driver = new AppiumDriver(new URL(""), capabilities);

    public void tearDown() throws Exception {

    public void addContact(){
        WebElement el = driver.findElement("Add Contact"));;
        List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText");
        textFieldsList.get(0).sendKeys("Some Name");
        driver.swipe(100, 500, 100, 100, 2);

Step3: Then Run this test and here is screenshot


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.