Features

Appium 2

Appium 2 is the new version of Appium, the mobile automation framework to run tests against websites and mobile apps on phones and tablets (both simulators/emulators and physical devices).

The main difference between Appium 2 and Appium 1 is that Appium 2 uses the concept of plugins and drivers.

This makes for a better ecosystem, with cleaner code and improved flexibility and performance.

The drivers will add support for any given platform, for example an xcuitest driver will provide support for iOS XCUITest automation, an espresso driver for Android Espresso.

Plugins allow for adding and customizing existing behavior of Appium. Drivers and plugins can be easily shared, installed or removed from Appium 2.

Appium 2 supports iOS 14 and above and Android 6 and above.

Appium 2 Versions

TestingBot currently supports these Appium 2 versions:

  • 2.5.1
  • 2.4.1
  • 2.3.0
  • 2.2.1
  • 2.2.0
  • 2.1.0
  • 2.0.0

If you specify "appiumVersion": "latest", TestingBot will automatically use the latest Appium version. You can also use latest-1, latest-2, ... to test on the next most recent versions of Appium.

Appium 2 example on TestingBot

Appium 1 and 2 are both supported on TestingBot, on all our physical devices and virtual devices: iOS simulators and Android emulators.

These Appium 2 drivers are installed on TestingBot:

These Appium 2 plugins are pre-installed and can be activated by specifying a tb:appiumPlugins capability (by default empty):

{
    'tb:appiumPlugins': ['images', 'execute-driver', 'universal-xml']
}

By default, TestingBot will use Appium 1 for all mobile tests. You can change this by specifying an Appium Version.

The example below will connect to the TestingBot device grid and will use Appium 2 to run a mobile automation test.

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("appium:platformVersion", "16");
capabilities.setCapability("appium:deviceName", "iPhone 14");
capabilities.setCapability("appium:automationName", "XCUITest");

HashMap<String, Object> tbOptions = new HashMap<String, Object>();
tbOptions.put("appiumVersion", "2.5.1");
capabilities.setCapability("tb:options", tbOptions);
        
const capabilities = {
  platformName: 'iOS',
  'appium:platformVersion': '16',
  'appium:deviceName': 'iPhone 14',
  'appium:automationName': 'XCUITest',
  'tb:options': {
    appiumVersion: '2.5.1'
  }
}
capabilities = {
  "platformName" : "iOS",
  "appium:platformVersion" : "16",
  "appium:deviceName" : "iPhone 14",
  'appium:automationName': 'UiAutomator2',
  "tb:options" : {
    "appiumVersion" : "2.5.1"
  }
}
capabilities = {
  "platformName" => "iOS",
  "appium:platformVersion" => "16",
  "appium:deviceName" => "iPhone 14",
  'appium:automationName'=> 'XCUItest',
  "tb:options" => {
      "appiumVersion" => "2.5.1"
  }
}
AppiumOptions capabilities = new AppiumOptions();

capabilities.AddAdditionalCapability("platformName", "iOS");
capabilities.AddAdditionalCapability("appium:platformVersion", "16");
capabilities.AddAdditionalCapability("appium:deviceName", "iPhone 14");
capabilities.AddAdditionalCapability("appium:automationName", "XCUITest");

HashMap<String, Object> tbOptions = new Dictionary<string, object>();
tbOptions.Add("appiumVersion", "2.5.1");
capabilities.AddAdditionalCapability("tb:options", tbOptions);

Appium 2 Changes

If you've been using Appium 1 and want to try out Appium 2, then please be aware of the possible breaking changes listed below.

Protocol Changes

Appium 2 only allows the W3C WebDriver Protocol. Even though Appium 1 has supported this protocol since recent years, it also supported JSONWP (JSON Wire Protocol) and MJSONWP (Mobile Json Wire Protocol).

This means that if you are using an older Appium client or binding, you might have trouble communcating with Appium 2.

Instead of using desiredCapabilities, you now need to use capabilities with either alwaysMatch or firstMatch properties.

Capabilities

Appium only accepts a couple of standard W3C capabilities, including:

  • browserName
  • browserVersion
  • platformName

All other capabilities, such as app or deviceName need to be vendor-prefixed. A vendor prefix means you prefix each key with a string followed by a colon. In Appium's case, this would be appium:

An example of some of the capabilities you can use with Appium 2:

  • appium:app
  • appium:deviceName
  • appium:noReset

automationName is required

With Appium 2, you now need to specify an automationName. Before, with Appium 1 this was filled in automatically if you did not specify it.

For iOS testing, you should use appium:automationName with XCUITest. For Android, you should set the appium:automationName capability to UiAutomator2.

TestingBot specific capabilities

You can specify all TestingBot specific capabilities with the tb:options capability.

See below for an example where we will be using both Appium 2 and custom TestingBot capabilities.

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("platformName", "ios");
capabilities.setCapability("appium:platformVersion", "16");
capabilities.setCapability("appium:deviceName", "iPhone 14");
capabilities.setCapability("appium:automationName", "XCUITest");

HashMap<String, Object> tbOptions = new HashMap<String, Object>();
tbOptions.put("appiumVersion", "2.5.1");
capabilities.setCapability("tb:options", tbOptions);