How to Get Started with Appium (sample included)

Everything About Appium Test Automation

Dear Testdroiders,

In case you’re interested to start testing your Android & iOS apps and games with Appium, here are the basic steps to get you up and running with it on real devices at Testdroid Cloud. 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 your machine

Testdroid Appium sample TestScripts are available in Python, Java and Ruby. Appium tests are executed remotely from user’s own machine, and the tests are executed on Testdroid Cloud 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 Appium environment step-by-step.

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 centre
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 the Testdroid 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 Testdroid Cloud via HTTP POST. Below is an example using cURL.

OS X / Linux
$ curl -s --user$w0rd -F myAppFile=@"/absolute/path/to/app/BitbarIOSSample.ipa" ""

$ cd C:pathtodirectorycontainingtheapplication
$ curl -s --user$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:


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" "<sessionId>"

Step 4: Get results from Bitbar Cloud
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

The Beginner’s Guide of Using Appium for Mobile App Testing

Learn all the basics about Appium, how to set it up and how to use it for mobile app testing.


  • Mark Steve

    Your post is highly valuable because the way you have explained is quite simple & easy to understand plus it can also help young developers. The main part of your blog are the steps that you have mentioned.
    event management applications

  • Fouziya Hanif

    Can i have the SAMPLE code to Run the appium by android studio.