Support Center

Start with Testdroid Python Sample Appium TestScript

Last Updated: Oct 06, 2015 02:14PM CEST

Setting up your machine

Testdroid Appium sample TestScripts are available in Python, Java, C# and Ruby. Appium tests are executed remotely from user's own machine, and the tests are executed on Testdroid Cloud in real time. Below is explained how to run your Python scripts locally from your machine.


Install Python

Ensure you have Python 2.7.x or later is installed (should be pre-installed on OS X)​

$ python --version​


You can Install Python on Linux as follows

$ sudo apt-get install python2.7


To install Python on Windows, 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:\Python27\Scripts\” in the end. (Assuming you installed Python at default location)

Make sure to restart the command prompt for new environment variables to come in effect.


Install pip

Check if Python's package installer 'pip' is already installed.

$ pip --version


$ curl >

$ sudo python

$ rm


$ sudo apt-get install python-pip


$ curl >

$ python

$ del

Install Python ‘selenium’ module

$ pip install selenium



Running the TestScript

Clone the Testdroid Appium Sample TestScripts from Github. It contains sample apps for iOS and Android and sample iOS and Android app tests too. The samples directory contains more detailed steps on how to use the sample scripts.

Step 0: Upload you app to cloud

To upload your app to Testdroid Cloud use the following curl-script:

curl -s --user '' -F myAppFile=@"/path/to/app/file.apk"

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 Desired Capabilities.
Set the myAppFile identifier from Step 0 against testdroid_app 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 Testdroid 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


Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found