Skip to main content

Appium Testing with Emulators and Simulators

With Sauce Labs, you can run automated Appium tests for your native and hybrid mobile apps against many virtual OS and platform combinations with Android emulators and iOS simulators.

What You'll Need#

Upload Your App to Emulators and Simulators#

To begin, upload your app to a publicly available source. Accepted file types are *.zip iOS package files for simulators and *.apk or *.aab Android package files for emulators. There are two ways you can upload your app for automated testing:

Set Your Test Credentials#

After you've uploaded your app, open a new test script. Add your Sauce Labs credentials (username and accessKey).


Credentials should not be stored in as text in your code where they might be stored in version control system. For every machine that executes the code, set your Sauce Labs credentials with environment variables.

Set Test Configurations#

There are numerous Test Configuration Options that can be used to generate the session you want and determine the behavior of the tests.

Here are some tips for configuring your Appium tests:

Set the Location of Your Mobile App#

Set the value of app to the location for where it can be accessed. This can be a full URL, or it can use Sauce Labs App Storage


Sauce Labs only allows you to set either browserName or app. If you have a value set for browserName Sauce will treat it as a mobile-web test instead of a native app test, so make sure this value is empty or removed.

Example of using Sauce Labs Storage:

Sauce Labs Storage

Set the appiumVersion#

We recommend specifying one of the newer Appium versions, which will provide a more extended API and fixes to known bugs. If this value is not set, an older default value may be used instead.

Check the Appium Version for Your Test#

  • Log in to Sauce Labs.
  • Find and select the test that you ran using Appium to view the Test Details page.
  • Click the Metadata tab.
  • Look for the Logs row and select Appium Log. The first line should indicate the Appium version. For example:
    2014-05-05T17:45:07.541Z - info: Welcome to Appium v1.9.0.

iOS Code Examples#

Below are examples of an iPhone 8 project using iOS version 12.2:

DesiredCapabilities caps = DesiredCapabilities.iphone();    caps.setCapability("appiumVersion", "1.13.0");    caps.setCapability("deviceName","iPhone 8 Simulator");    caps.setCapability("deviceOrientation", "portrait");    caps.setCapability("platformVersion","12.2");    caps.setCapability("platformName", "iOS");    caps.setCapability("browserName", "");    caps.setCapability("app", "");

Android Code Examples#

Below are examples of an Samsung Galaxy S9 Plus project using Android version 8.1:

DesiredCapabilities caps =;    caps.setCapability("appiumVersion", "1.9.1");    caps.setCapability("deviceName","Samsung Galaxy S9 Plus FHD GoogleAPI Emulator");    caps.setCapability("deviceOrientation", "portrait");    caps.setCapability("browserName", "");    caps.setCapability("platformVersion","8.1");    caps.setCapability("platformName","Android");    caps.setCapability("app", "");

Native Apps vs. Hybrid Apps#

iPhone Native App

DesiredCapabilities caps = DesiredCapabilities.iphone();caps.setCapability("appiumVersion", "1.9.0");caps.setCapability("deviceName","iPhone 8");caps.setCapability("deviceOrientation", "portrait");caps.setCapability("platformVersion","14.3");caps.setCapability("platformName", "iOS");caps.setCapability("browserName", "");caps.setCapability("app","");

iPad Native App

DesiredCapabilities caps = DesiredCapabilities.iphone();  caps.setCapability("appiumVersion", "1.9.0");  caps.setCapability("deviceName","iPad Retina");  caps.setCapability("deviceOrientation", "portrait");  caps.setCapability("platformVersion","14.3");  caps.setCapability("platformName", "iOS");  caps.setCapability("browserName", "");  caps.setCapability("app","");

iPhone Hybrid App,

DesiredCapabilities caps = DesiredCapabilities.iphone();    caps.setCapability("appiumVersion", "1.9.0");    caps.setCapability("deviceName","iPhone Retina (4-inch 64-bit)");    caps.setCapability("deviceOrientation", "portrait");    caps.setCapability("platformVersion","7.1");    caps.setCapability("platformName", "iOS");    caps.setCapability("browserName", "");    caps.setCapability("app","");

Example Appium Test Scripts#

These Appium scripts for iOS and Android mobile app tests on emulators and simulators can help streamline your testing process. Below are links to the Sauce Labs Training on GitHub repository, where you'll find demo scripts for a variety of use cases to get you started with automated Appium testing:

Additional Resources#

Once you've been able to get a test running on Sauce, check out our best practices and available modifications you can make to your tests:


Lean how to run Appium Android tests on an Emulator in the Automation Quickstart Course.