How to Get Started with Appium (Sample Included)

  October 14, 2014

In case you’re interested to get started with Appium for testing your Android & iOS apps and games, here are the basic steps to get you up and running with it on real devices at Bitbar Testing. Just follow these steps, with provided sample and test scripts, and you’ll see how easy it actually is.

Testdroid + Appium + Real Devices = Awesome Combo

Setting Up Appium to Get Started

Bitbar’s Appium sample TestScripts are available in Python, Java and Ruby. Appium tests are executed remotely from the user’s own machine, and the tests are executed on Bitbar in real-time. To run the Python scripts locally from your machine, follow the instruction below on setting up your machine. Otherwise, you can download our free beginner’s guide and learn how to set up a proper environment to get started with Appium.

OS X / Linux

Ensure that Python 2.7.x or later is installed (pre-installed on OS X)

$ python --version

Install Python if not installed (Linux only)

$ sudo apt-get install python2.7

Check if Python ‘pip’ module is already installed

$ pip --version

Install pip if not installed (OS X)

$ curl >
$ sudo python
$ rm

Install pip if not installed (Linux)

$ sudo apt-get install python-pip

Install Python ‘selenium’ module

$ sudo pip install selenium

Verify that ‘selenium’ is installed

$ pip freeze | grep -i selenium


Ensure that Python 2.7.x or later is installed

$ python --version

If not installed, download and run setup from download center
To add Python environment variables, go to System Properties > Advanced System Settings > Environment Variables > System Variables > Edit ‘Path’, and insert “C:Python27;C:Python27Scripts” in the end (Assuming you have installed Python at default location). Make sure to restart the command prompt for new environment variables to come in effect.

Check if Python ‘pip’ module is already installed

$ pip --version

Install pip if not installed

$ curl > $ python $ del

Install Python ‘selenium’ module

$ pip install selenium

Running the TestScript

Download our Appium Sample TestScripts and sample applications archive, which includes sample iOS and Android apps the tests are written for. Navigate to the downloaded scripts directory via command line. There are three sample TestScripts:

1. (for iOS)
2. (for Android version >= 17)
3. (for Android version < 17)

Step 0: Upload the app

Before proceeding with running the TestScript, you need to upload the .ipa/.apk to Bitbar Testing via HTTP POST. Below is an example using cURL.

OS X / Linux

$ curl -s --user [email protected]:pas$w0rd -F myAppFile=@"/absolute/path/to/app/BitbarIOSSample.ipa" ""


$ cd C:pathtodirectorycontainingtheapplication
$ curl -s --user [email protected]:pas$w0rd -F myAppFile=@"BitbarIOSSample.ipa" ""
On successful upload, you would get a JSON response with status:0, and a unique identifier to the uploaded app.
    "status": 0,
    "sessionId": "abcdefg-1234-5678-abcd-111122223333",
    "value": {
        "message": "Uploads Successful",
        "uploadCount": 1,
        "rejectCount": 0,
        "expiresIn": 1800,
        "uploads": {
            "myAppFile": "abcdefg-1234-5678-abcd-111122223333/BitbarIOSSample.ipa"
        "rejects": {}
Step 1: Set credentials and other parameters

Open the TestScript in any text editor. Set the screenshotDir to path where you want the screenshots to be saved in at your machine. Set your credentials against testdroid_username and testdroid_password in Desired Capabilities. Set the myAppFile identifier from Step 0 against testdroid_app in Desired Capability. Details on all testdroid_ Desired Capabilities can be found here, but you can use default values for now.

Step 2: Run the TestScript
$ python

The output should look like:

webdriverrequest to get started with appium
Step 3 (optional): Upload your Test Suite output to Cloud

If your test suite generates a JUnit XML results file, you can upload the XML to Cloud. Doing this will show the test-cases and their statuses on the Web UI, and let you download test reports.

> Add the testdroid_junitWaitTime Desired Capability in your TestScript.
> Get Appium sessionId from your script (after the WebDriver connection has been established) using: driver.session_id()
> After your test run has finished, and JUnit XML has been generated, use Curl to upload the XML to Cloud:

$ curl -s -F result=@"/absolute/file/path/TestOutput.xml"
Step 4: Get results from Bitbar Testing

The screenshots are available locally on your machine inside the directory you specified in Step 1.
Log into and navigate to project name as defined in testdroid_project Desired Capability to get the following log files.

  1. Appium server log
  2. Logcat / Instruments log