Here we give an overview of how to test mobile device apps on Android using Appium, the open source testing framework.  We will use Ubuntu, Android, and Python and provide line-by-line instructions including what you need to download and install and how to run a test.

The idea is you can set up the emulator for multiple Android devices, OS versions, screen sizes, etc., and run multiple tests to do volume testing.


Appium is used to test mobile apps by running them from another server, like, in this example, Ubuntu.   It uses the Selenium WebDriver to connect to the mobile device and launch the app.

In this example, we use Android, although Appium works for iOS too.  Appium also works to test web pages.  So it does what the Selenium does, i.e., test web pages, plus test mobile apps, i.e., installed apps and not those run from a mobile web browser.

Appium is cross-platform. If you use Apple’s UIAutomation you can only use JavaScript.  If you use Google’s UiAutomator you can only use Java.  Appium lets you use the language you prefer to write the unit tests.

The diagram below gives an overview of the Appium test architecture.


Reading around the diagram, we see the Appium server, a Python test program, an Android app, a Python testing framework, and the Selenium web driver.


Here is how to install the pieces you need to run a test on Android with Ubuntu and Python.  Consult the Appium getting started web page for other platforms, iOS, and other programming languages.

[See Also: The Importance of ServiceNow in Cloud Management]


You will obviously need the Android SDK to test an Android app so that you can deploy the .apk to a physical or virtual device using adb, the Android command line tool. So install that.  You don’t need Eclipse, just the Android SDK. Once you install it you can run android-sdk-linux/tools/android to start the UI and start an emulator.  You will have to download a virtual machine image and the Android SDK versions you wish to test.


In addition, you need node.js and npm to run Appium.  Important Note: Appium will not work if you installed
those using sudo.  So you have to use Homebrew, which was written for Mac, to install Appium.  The port of Homebrew to Ubuntu is called Linuxbrew.  What Linuxbrew does is download the source code and run make install allowing the installation of packages requiring root access.

Use these instructions from Digital Ocean to install Linuxbrew.

Once you do that, run these instructions to install Appium into Node.js:

npm install -g appium
npm install wd
appium &

Now run appium-doctor to check that everything is setup correctly.

Now run appium.  The server should start and look something like this:


Now we will test the Android app by instantiating the app on the mobile device from the Python test program.
Depending, you may need an Appium client library for the language you are using.  Here is the one for Python.   Install that and the pytest Python test framework like this:

pip install Appium-Python-Client
pip install pytest

[See Also: Cloud Computing & Software Development Rooted to Interlocked Evolution]

Another note: You might get stuck with problems of Python3 versus Python2 and getting the correct version of pip.  It can be a mess, on Ubuntu, as you know. So consult StackOverflow and Google.  In setting up this example on Ubuntu 14.04, we had that problem.  The way we fixed it was to make sure we were running pip3 like this:

sudo apt-get install python3-pip
and then typing “pip3” instead of “pip.”
pip3 install Appium-Python-Client


Clone into the Appium github to get the sample test code:

git clone


You need an Android app to test.  Download Appium sample app.

Install on it an Android device. (Remember that you need to allow the installation of apps not distributed from

Google Play in Android settings on the device):

./adb install /home/walker/Downloads/ApiDemos-debug.apk


Then run it:


Now you should see the Appium console reacting to the program:


From here, of course, you would look at the logcat logs to interpret the test results to prove that your app worked and then fix the app if it did not.

Everything you need to know about outsourcing technology developmentAccess a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.

Introduction Package

Source: zymr

Zymr blogger


Leave a Reply

© 2019, Zymr, Inc. All Rights Reserved.| LEGAL DISCLAIMER | PRIVACY POLICY | COOKIE POLICY