Setting up a device or emulator in Eclipse and Appium

When using test automation for Mobile you can use Eclipse and Appium to connect to your device or emulator. Setting up device capabilities is quite easy and can be used for both setups. Below are some examples on how to get your emulator or device connected quickly using an Eclipse / Appium combination.

First you have to set the device capabilities in your Eclipse JUnit test. Assuming you have setup your project to use Appium (e.g. Import org.appium…). Below an example that works for both Mac OS and Windows:

public void setUp() throws Exception {
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", "Android Emulator");
  capabilities.setCapability("platformName", "Android");
  capabilities.setCapability("platformVersion", "4.4"); 
  capabilities.setCapability("browserName", "Chrome");
  driver = new RemoteWebDriver(
           new URL(""), capabilities);

Using this basic setup you can connect to your f.e. ADB emulator or such. For iOS just switch the settings so it matches your emulated device. If you want to connect to a real device just change the deviceName capability so it matches the name you retrieved from your device (f.e. using ADB).

When setting up Appium using the basic settings you should be able to connect quite easily. Just set up the basics like Platform Name, PlatformVersion and set the device name.

If the above doesn’t work for you then try the capability settings below in Eclipse:

public void setUp() throws Exception {
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4");
  capabilities.setCapability(MobileCapabilityType.APP, "C:/Tools/Calculator.apk");
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
  driver = new AndroidDriver(new URL(""), capabilities);

You can also add additional settings to Appium when your connection isn’t working. See below for the options you could use the following:


In my next blog post I will give a brief explanation on setting up a basic setup for mobile automation.

Author: Antoin Boerboom

AUTHOR BIO: Antoin is an experienced test consultant working for Polteq in The Netherlands. He enjoys working in agile environments and is dedicated to helping testers get the most out of their work in agile teams. On top of that he has a strong interest in all things new in technology, making him a front runner in his field.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.