Appium Tip #1: How to Get Started, Setup and Run Your First Tests

  September 30, 2015

This is the first blog in our Things You Should Know About Appium blog series, and we’ll naturally start with the basic things, getting the environment set up, Appium pieces installed and running on your machine. Depending on which programming language you are using, we’ve tried to provide here everything, step-by-step, for those 4 main languages to get you started with Appium tests.

To get started, first download our sample Appium tests. The example is available in C#, Python, Java and Ruby, and we’ll be using these as a basis for the next examples. Okay, then depending on which programming language you will be using, select the appropriate client library as follows. Or you can download our free Appium beginner’s guide to access your local copy anytime.

Most of the Testdroid examples are located in our Github repositories. To make most out of the existing samples you should have Git installed. If you are new to Git, there is a very good guide on how to install Git on a popular operating system here. Below is the abbreviated version of the installation procedures.

Mac OS X

Download the latest git command-line tool from install it using normal Mac installation procedure.


Use the following command to get Git installed on your Linux machine:

$ sudo apt-get install git


The easiest and most straight forward way is to install the Github Windows application.


Mac OS X and Linux

Our Python samples have been created with the 2.7.x version in use, so best compatibility can be expected with the same. Check that the newest Python 2.7.x version is installed by using the following command:

$ python --version

If not installed, you can install Python by using the following commands:

Linux: $ sudo apt-get install python2.7
OSX: $ brew install python

Brew is a handy package manager tool, similar to apt-get. If you don’t have it, check the brew website for its one-liner installation.
Then, check if ‘pip’ module is installed. Use the following command:

$ pip --version

If ‘pip’ is appropriately installed, you’ll see something like this:

pip 1.5.6 from /Library/Python/2.7/site-packages (Python 2.7)

If not, use the following command to install it:

Linux: $ sudo apt-get install python-pip
OSX: $ sudo easy_install pip

Next, install the Selenium module for Python:

$ pip install selenium

And finally, verify that Selenium got installed:

$ pip list | grep selenium


Ensure that the newest Python 2.7.x version is installed. Go to the command line and use the following:

> python --version

If Python 2.7 or newer is not installed, download and run the setup from Python’s download center. To add Python into environment variables, go to Windows “System properties” → “Advanced System Settings” → “Environment Variables” → “System Variables” →  choose “Path” and press “Edit…” and then insert (assuming you have installed Python in the default location) ;C:Python27;C:Python27Scripts at the end separating each path with a semicolon. Make sure to re-launch the command prompt to bring new environment variables into effect.

Then, check whether Python’s pip module is already installed:

> pip --version

Install pip if it’s not already (we assume here that you have cURL installed. If not, check this out):

> curl >
> python
> del

Install Python’s Selenium module:

$ pip install selenium


Appium testing supports writing tests in multiple programming languages, including Java. Testing can be done against native or hybrid apps or responsive web pages on both iOS and Android devices. Only the test setups differ.

With Java, things are pretty simple and you only need to configure your test file accordingly. You can use SampleAppium(iOS) as an example/template.

In case you don’t have an IDE with Maven included and would like to launch the example from the command line, you will need to make sure that Maven is properly installed. Here’s a link to the installation instructions.



Launch the AppiumTest.sln on Visual Studio and make sure that the NUnit Test Adapter is installed through the Extension Manager. Use Test Explorer to run your tests.


First, install Monodevelop for C# support. Then, download dependencies using Nuget:

$ nuget install Test123/packages.config -OutputDirectory packages

To build the package, simply use the following command on the correct path:

$ xbuild


First, install the latest stable release of Ruby:

$ curl -sSL | bash -s stable
$ rvm install ruby

Then, make sure RVM is using the correct Ruby by default:

$ rvm list
$ rvm --default use 2.1.1

In case you have an old Ruby/RVM, you can upgrade those with the following commands:

$ rvm get head
$ rvm autolibs homebrew
$ rvm install ruby

Check that it’s installed properly by printing out the Ruby version:

$ ruby --version

Update RubyGems and Bundler:

$ gem update --system
$ gem install --no-rdoc --no-ri bundler
$ gem update
$ gem cleanup

Check that RubyGems is >= 2.1.5

$ gem --version

Run bundler at the Ruby example directory to install dependencies:

$ bundle install

All Programming Languages: How to Configure Specific Settings

If you used any of those example files as a template, add your Bitbar user credentials in this script. You can also use environmental variables TESTDROID_USERNAME and TESTDROID_PASSWORD to get your credentials used:

String testdroid_username = env.get("TESTDROID_USERNAME");
String testdroid_password = env.get("TESTDROID_PASSWORD");

Or alternatively, you can edit testdroid_username and testdroid_password in your source file:

capabilities.setCapability("testdroid_username", '[email protected]');
capabilities.setCapability("testdroid_password", 'secretPassword123');

If you are new with desired capabilities or if you are looking for more information on how to use those efficiently, take a look at this article.

Also, if you want to run tests against your application, make sure to change a file path to your application binary (whether you are running against APK or IPA):

private static final String TARGET_APP_PATH = "../../../apps/builds/BitbarSampleApp.apk";

In addition, there are lots of possible ways to configure your test run for our devices. In order to do this, you need to configure those desired capabilities. We’ll get the bottom of this later in the blog series, but the current examples are as follows:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("testdroid_target", "Android");
capabilities.setCapability("deviceName", "Android Device");
capabilities.setCapability("testdroid_project", "LocalAppium");
capabilities.setCapability("testdroid_testrun", "Android Run 1");
// See available devices at:
capabilities.setCapability("testdroid_device", "Samsung Galaxy Nexus GT-I9250 4.2.2");
capabilities.setCapability("testdroid_app", fileUUID); 

In this Java example, you only really need to configure testdroid_username and testdroid_password, since sample application upload is included.

Running Your First Appium Tests

Before the test can start you need to upload your application to Bitbar Testing. This can be done either via API or you can do it manually as well.


To upload your app file (either APK or IPA) to Bitbar Testing, open and configure the script. As we walked it through, you only need to configure your username (email) and password that you registered with to Bitbar Testing. Also, you need to set the full path to your mobile app. This can be an Android or iOS application. Then execute this:

$ python

To run a test:

$ python


You can run the test from your IDE or directly from the command line using Maven:

> mvn clean test -Dtest=SampleAppiumTestZ

or to be more precise:

> mvn clean test

or run all the tests:

> mvn clean test 


To run tests, either launch them in Visual Studio via the Text Explorer or use the nunit console command:

$ nunit-console Test123/bin/Debug/TestdroidAndroidSample.dll


Run the tests with rspec:

$ rspec testdroid_android.rb


There’s a myriad of different ways you can set up, build and run your Appium tests. The ones provided here were just one example of how things can be done. Stay tuned – more good stuff about Appium is coming out in a few days!

Happy Appium Testing!