Introduction
In general, Capabilities describes a series of key/value pairs that can customize or configure a Device or Browser session for testing to Selenium or Appium WebDriver.
Continuous Testing extends these capabilities and introduces Device Query capability. It is a special type of capability which describes one or more capabilities in a single query like input.
The code snippet below is used to set Device Query using Selenium\Appium Java client bindings.
/** * Creates an Android Driver with Desired Capabilities. * */ protected void createDriverWithCapabilities() { LOGGER.info("Setting up Desired Capabilities"); String accessKey = System.getenv(ENV_VAR_ACCESS_KEY); dc.setCapability(SeeTestCapabilityType.ACCESS_KEY, accessKey); dc.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS"); String deviceQuery = String.format("@os=android and @dhmlocation='us-1'", "android"); dc.setCapability(SeeTestCapabilityType.DEVICE_QUERY, deviceQuery); AppiumDriver driver = new AndroidDriver(SeeTestProperties.SEETEST_IO_APPIUM_URL, dc) : }
Few important observations can be made from the code above,
- Device Query is set using the key SeeTestCapabilityType.DEVICE_QUERY.
- Multiple capabilities can be set in one single query input i.e. device query="@os=android and @location='US', as opposed to Appium capability which needs to be set one by one.
- Property os overrides MobileCapabilityType.PLATFORM_NAME as they have the same meaning.
Supported Properties
Listed below are the properties or Key and Value which Device Query supports.
Property Name | Property Value | Example or Possible Values |
---|---|---|
os | Operating system. |
|
serialnumber | Serial Number of the device. | Unique identifier of the device in the SeeTest cloud. |
version | The device's operating system version (for example 4.1.2). | Any Device version Example: 4.1.2 |
versionnumber | The device's operating system version number (for example 4.1). | Any Device version number Example: 4.1 |
category | The device category. Currently supported in android devices. |
|
modelName | Device marketing name | Example: Galaxy S7 Edge |
model | Device model | Example: SM-G935F |
dhmlocation | Location of the host machine as set in the SeeTestCloud configuration. | Example: us-1 |
manufacture | Manufacturer of the device. | Example: apple |
name | Kind of the device | Example: iPhone 7 |
tag | Device tag (that was added by Cloud / Project administrator) | Example: new_device |
region | Region of the device's DHM | Example: Argentina |
Syntax and Examples:
Device Query is written in XPATH Syntax i.e. @<propertyname>='<propertyvalue>' [ and @<propertyname>='<propertyvalue>' .....].
Device tags are added to query without @ character: tag='new_device'
Listed below are some examples
Example | Description |
---|---|
"contains(@dhmlocation,'us') and @manufacture='Samsung' and @os='android' and @version='4.2.2' | Requesting a device,
|
"@model='iphone' and @os='ios' and contains(@name, 'iPhone')" | Requesting a device,
|
"@model='iphone' and @os='ios' and starts-with(@name, 'iPhone')" | Requesting a device,
|
@os='ios' and tag='new_device' and tag='released_2019' | Requesting a device,
|