Mobile App Automation with & Appium

Following Dwane’s recent blog post on how to get started with, I decided to write a short tutorial on how you can easily integrate appium to the framework to test web apps on real devices and simulators.

“Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS mobile, Android mobile, and Windows desktop platforms.”

Such a setup will help you to execute your tests on the phone’s browser and also test hybrid applications. I will be using a Mac for this tutorial, as iOS simulators are only available through XCode. Similar steps are required to get our tests up and running on both iOS & Android devices.

1. Install Appium

Assuming you have Dwane’s code up and running, we need to install appium globally and also include it as a dependency in our package.json.

npm install appium -g
npm install appium

Check that your package.json dependencies is similar to the following:

2. Installing appium service

The team at were kind enough to provide us with an appium service. Such a service eliminates the need to start appium manually before starting your tests. We should install this as a dev dependency:

npm install wdio-appium-service --save-dev

3. Appium Doctor

Appium Doctor lets you know if you have the right configuration to start running your appium tests. We can install this globally:

npm install appium-doctor -g



4. wdio configuration

If appium-doctor gave you the go ahead, we could start setting up our wdio config file.
a. First of all, appium listens to a particular port: 4723. So we must add this to the top of our configuration.
b. We must then add the service, with some arguments:

c. Finally, we need to set our capabilities:

These capabilities are for running tests on simulators/emulators. These virtual devices will not install on runtime, so always make sure that what you include in your wdio.conf file is installed on your machine.

To check which iOS simulators and Android emulators you have installed, just execute the following commands in your terminal:


instruments -s devices


emulator -list-avds

If you would like to add more simulators or emulators to the list, you can install them through XCode and android studio respectively.

Boot up the chosen virtual devices for faster results, and you can run your tests Yep it is that easy

./node_modules/.bin/wdio wdio.conf.js

Instead of declaring the port in the wdio.conf.js file you can also pass it as a command line argument:

./node_modules/.bin/wdio wdio.conf.js --port 4723

These commands can be set as npm scripts in your package.json to make it easier to remember:

And finally:

npm run appium

Organising your tests

This setup is great if you only want to run your tests using appium, but what if you need to run tests on desktop browsers as well? Unfortunately, you cannot pass which capabilities you want to run your tests as a command line argument, as does not support this.

What I found useful is to separate your appium configuration altogether. This can be done by creating a new file: wdio.appium.conf.js and in it only include appium configuration leaving wdio.conf.js just for your traditional browsers.

Your npm scripts would change as follows:

This way you can run your preferred capabilities without the need to change the wdio.conf.js every time before execution.

If you would like to run the actual app on the simulator, all you need to do is add the following to your capability:

You can find all the code in our GitHub Repo.

Joe Colantonio recently released a blog post: Top 8 Appium Mobile Test Automation Mistakes To Avoid. This post is worth a read, and it also contains some interesting TestTalk podcasts regarding the topic.

Do you have any more useful tips that I did not include? Or have a different setup? Let us know in the comment section below!

P.S. We are looking for guest authors, interested? Contact us.

The post Mobile App Automation with & Appium appeared first on Testautonation.