Appium Android Test (OSX)

In this post I will show you the basic steps to install appium on OSX by using the official App, to use the inspector and to run your first android test case.

Basic setup

The follwing packages are required:

  • Android SDK
  • JAVA

I had to do the following steps before I was able to run the inspector:

  • set JAVA_HOME (see instructions)
  • select your *.apk-file
    • click on the Android-Icon
    • enable App Path and select the path to your *.apk-file
  • enable "Prelaunch Application" in "General Settings"
  • set the android-sdk path in the advanced android settings:
    • click on the Android-Icon
    • click on Advanced tab
    • enable "Android SDK Path"
    • enter the path to your android sdk (e.g. content of your Android_Home Env-Var or see instructions)
  • (although it's available in the ENV Variable ANDROID_HOME. I think the problem is that I am a zsh user and the app will just load a bash or sh environment and so my ~/.zprofile will not be sourced).


Per Default you have to start your virtual device manually, but you can tell your to do it for you:

  • open
  • stop server if running
  • click on the android-icon
  • select basic settings-tab
  • enable "launch AVD" and enter the name of your virtual device

Write firsst testcase

Appium allows the usage of a lot of different programming lanuages (e.g. ruby, python, js,...). I will show how to write and run a simple test in python (source).


  • running appium server
  • python and pip already installed
pip install Appium-Python-Client

A first test case (for the official telegram android app) could look like this:

import os
import unittest
from appium import webdriver
from time import sleep

# Returns abs path relative to this file and not cwd
PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)

class TelegramAndroidTests(unittest.TestCase):
    def setUp(self):
        desired_caps = {
            'app': PATH('../Telegram/TMessagesProj/build/outputs/apk/TMessagesProj-release.apk'),
            'appPackage': 'org.telegram.messenger',

        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

    def tearDown(self):

    def test_nothing(self):

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TelegramAndroidTests)

Now you can run it like a normal python script:


This test case does nothing special, but the script connects to the appium server, opens the app and launches the activity. You find your appActivity and appPackage arguments in your AndroidManifest.xml.