Automation Digital Labs and Desired Capabilities

Automation Digital Labs and Desired Capabilities

    We know that automation testing is one of the important factors in the software testing world. Coverage of automation testing is another critical point, moreover the availability of different real devices, different brands of devices, different versions of devices, and different browsers. Modern DevOps and Quality environments require apps to be tested on hundreds of device/OS/browser combinations. Managing an in-house device-lab is expensive, resource-intensive, restrictive, and very manual. Most of the organizations are utilizing Automation Digital Labs to get all the real devices and browser under a single umbrella.

   A digital lab provides access to real devices and browsers through an automation interface with a guaranteed level of uptime, or service availability, to support Agile development of web and mobile apps. Various vendors are providing Digital Labs in the cloud. The testers and developers can use the cloud digital labs for manual as well as automation testing. In this article, I would like to share short information about various cloud digital labs like Perfecto, SeeTest, Browserstack, Sauce Labs, HeadSpin, Kobiton and TestingBot. Also, I like to share the desired capabilities used to automate and run the applications in such cloud digital labs.

     Desired Capabilities help to configure the Appium server and provide the criteria which we wish to use for running our automation script. For example, we can request the environment (emulator or real-device), which version of the operating system to run the test on, and more. Desired Capabilities are key/value pairs encoded in JSON format and are sent to the Appium Server by the Appium client when a new automation session is requested. Next, we will see the desired capabilities used in various cloud digital labs.

1. Perfecto Cloud

     Perfecto Cloud is a web-based cloud platform that helps to do manual and automation testing of mobile and web applications. Perfecto Cloud provides access to its real-devices in the lab. For that, you need to register an account with Perfecto Cloud. To get security token from your perfecto cloud > Profile > My Security. Following are the important desired capabilities:

String URL = “https:// ” + “YOUR_PERFECTO_CLOUD_URL” + “/nexperience/perfectomobile/wd/hub”;
String SECURITY_TOKEN = “YOUR_SECURITY_TOKEN”;

Desired Capabilities for Web Application

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“securityToken”, SECURITY_TOKEN );
capabilities.setCapability(“platformName”, “Windows”); //You can use MAC as platformName if you are running in MAC system
capabilities.setCapability(“platformVersion”, “10”);
capabilities.setCapability(“browserName”, “Internet Explorer”);
capabilities.setCapability(“browserVersion”, “11”);
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Web

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“securityToken”, SECURITY_TOKEN );
capabilities.setCapability(“platformName”, “Android”); //For iOS, you have to use iOS.
capabilities.setCapability(“udid”, “DEVICE_UDID_FROM_PERFECTO”);// You will get the udid of the device from perfecto cloud.
capabilities.setCapability(“browserName”, “chrome”);//For iOS, you have to use Safari.
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“securityToken”, SECURITY_TOKEN );
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“udid”, “DEVICE_UDID_FROM_PERFECTO”);// You will get the udid of the device from perfecto cloud.
capabilities.setCapability(“app”, “YOUR_APP_LOCATION”);// Application location in perfecto cloud. If you are using application location then below appActivity capabilty not needed.
capabilities.setCapability(“appPackage”, “YOUR_APP_PACKAGE”);// Your application package name
capabilities.setCapability(“appActivity”, “YOUR_APP_ACTIVITY”);//Your application activity name
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“securityToken”, SECURITY_TOKEN );
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“udid”, “DEVICE_UDID_FROM_PERFECTO”);// You will get the udid of the device from perfecto cloud.
capabilities.setCapability(“app”, “YOUR_APP_LOCATION”);// Application location in perfecto cloud. If you are using application location then below bundleId capabilty not needed.
capabilities.setCapability(“autoInstrument”, true);
capabilities.setCapability(“bundleId”, “YOUR_APP_BUNDLEID”);//Your application bundle ID.
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

2. SeeTest Cloud

     Expiritest provides SaaS digital assurance lab and access to hundreds of browsers & mobile devices (physical / emulated) hosted in Experitest data centers, from anywhere at any time. It helps to do automation for both web and mobile applications. You should register in SeeTest Cloud to get the device access and ACCESS KEY. To get ACCESS KEY, go to your SeeTest cloud, click on your profile → Get Access Key. Following are the important desired capabilities:

String URL = “https:// ” + “YOUR_SEETEST_CLOUD_URL” + “/wd/hub”;
String ACCESS_KEY = “YOUR_ACCESS_KEY_FROM_SEETEST_CLOUD”;

Desired Capabilities for Web Application

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“testName”, “Web Test Execution”);
capabilities.setCapability(“accessKey”, ACCESS_KEY);
capabilities.setCapability(CapabilityType.PLATFORM_NAME, “WIN8”);/You can use MAC as platformName if you are running in MAC system.
capabilities.setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
capabilities.setCapability(CapabilityType.VERSION, “83”);
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Web

DesiredCapabilities capabilities= new DesiredCapabilities();
capabilities.setCapability(“testName”, “Mobile Web Test Execution”);
capabilities.setCapability(“accessKey”, ACCESS_KEY);
capabilities.setCapability(“deviceQuery”, “@os=’android'”);If you are using iOS, then value should be ios for @os.
capabilities.setCapability(“deviceModel”, “samsung”);//Device model will get from SeeTest Cloud.
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “8.0.0”);
capabilities.setCapability(MobileCapabilityType.UDID, “DEVICE_UDID_FROM_SEETEST”);
capabilities.setBrowserName(MobileBrowserType.CHROMIUM);//For iOS, you can use SAFARI
driver = new AndroidDriver<>(new URL(URL), capabilities);//For iOS, you can use IOSDriver instead of AndroidDriver

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities= new DesiredCapabilities();
capabilities.setCapability(“testName”, “Android Mobile Native Test Execution”);
capabilities.setCapability(“accessKey”, ACCESS_KEY);
capabilities.setCapability(“deviceQuery”, “@os=’android'”);
capabilities.setCapability(“deviceModel”, “samsung”);//Device model will get from SeeTest Cloud.
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “8.0.0”);
capabilities.setCapability(MobileCapabilityType.UDID, “DEVICE_UDID_FROM_SEETEST”);
capabilities.setCapability(MobileCapabilityType.APP, “cloud:APP_PACKAGE_NAME/APP_ACTIVITY_NAME”);
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, “YOUR_APP_PACKAGE”);
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, “YOUR_APP_ACTIVITY”);
driver = new AndroidDriver<>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities= new DesiredCapabilities();
capabilities.setCapability(“testName”, “iOS Mobile Native Test Execution”);
capabilities.setCapability(“accessKey”, ACCESS_KEY);
capabilities.setCapability(“deviceQuery”, “@os=’ios'”);
capabilities.setCapability(“deviceModel”, “iphone 6”);//Device model will get from SeeTest Cloud.
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “11.0”);
capabilities.setCapability(MobileCapabilityType.UDID, “DEVICE_UDID_FROM_SEETEST”);
capabilities.setCapability(MobileCapabilityType.APP, “cloud:APP_BUNDLEID”);
capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, “YOUR_APP_BUNDLE_ID”);
driver = new IOSDriver<>(new URL(URL), capabilities);

3. Browserstack

    BrowserStack is a cloud web and mobile testing platform that enables developers and testers to test their websites and mobile applications across on-demand browsers, operating systems, and real mobile devices. Browserstack provides different ways of testing facilities includes LIVE – interactive cross-browser testing, AUTOMATE – for automated web testing, APP LIVE – interactive mobile app testing, and APP AUTOMATE – automate mobile app testing. You have to register with the Browserstack platform. Following are the important desired capabilities:

You will get USERNAME and ACCESS_KEY from https://www.browserstack.com/accounts/settings
String USERNAME = “YOUR_BROWSERSTACK_USERNAME”;
String ACCESS_KEY = “YOUR_BROWSERSTACK_ACCESS_KEY”;
String URL = “https:// ” + USERNAME + “:” + ACCESS_KEY + “@hub-cloud.browserstack.com/wd/hub”;

Desired Capabilities for Web Application

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“os”, “OS X”);//To run on Windows platform, you can use Windows as value for os.
capabilities.setCapability(“os_version”, “Catalina”);//You will get OS version from Browserstack cloud.
capabilities.setCapability(“browser”, “Safari”);
capabilities.setCapability(“browser_version”, “13.0”);
capabilities.setCapability(“browserstack.local”, “false”);
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Web

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“device”, “iPhone XS”);//You will get device details from Browserstack cloud
capabilities.setCapability(“os_version”, “13”);
capabilities.setCapability(“real_mobile”, “true”);
capabilities.setCapability(“browserstack.local”, “false”);
capabilities.setCapability(“browserName”, “Safari”);//In case of Android, you can use Chrome as the browserName value.
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);//For Android, you can use AndroidDriver instead of IOSDriver.

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“device”, “Samsung Galaxy S20”);//You will get device details from Browserstack cloud
capabilities.setCapability(“os_version”, “10.0”);
capabilities.setCapability(“real_mobile”, “true”);
capabilities.setCapability(“app”, “bs://<hashed app-id>”);//You have to upload the app into Browserstack repostory and you will get the hashed app-id. 
capabilities.setCapability(“browserstack.local”, “false”);
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“device”, “iPhone XS”);//You will get device details from Browserstack cloud
capabilities.setCapability(“os_version”, “13”);
capabilities.setCapability(“real_mobile”, “true”);
capabilities.setCapability(“app”, “bs://<hashed app-id>”);//You have to upload the app into Browserstack repostory and you will get the hashed app-id. 
capabilities.setCapability(“browserstack.local”, “false”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

You can find the code snippet to upload the application into Browserstack repository and retrieve the application URL at https://journeyofquality.com/2018/03/24/browserstack-supports-mobile-native-automation/

4. Sauce Labs

     A cloud-based automated testing platform enables developers and testers to perform functional and manual tests with Selenium or Appium on web and mobile apps. It supports real and virtual devices. You have to register with Sauce Labs to get access to the devices and their capabilities. Following are the important desired capabilities:

You will get USERNAME and ACCESS_KEY from https://app.saucelabs.com/user-settings
String USERNAME = “YOUR_SAUCELABS_USERNAME”;
String ACCESS_KEY = “YOUR_SAUCELABS_ACCESS_KEY”;
String URL = “https:// ” + USERNAME + “:” + ACCESS_KEY + “@ondemand.saucelabs.com:443/wd/hub”;

Desired Capabilities for Web Application

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platform”, “macOS 10.15”);//You will get platform details from Sauce Lab cloud.
capabilities.setCapability(“browserName”, “Safari”);
capabilities.setCapability(“version”, “13.0”);
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Web

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “iPhone XS Simulator”); //You will get device name details from Sauce Lab cloud.
capabilities.setCapability(“platformVersion”, “13.2”);
capabilities.setCapability(“platformName”, “iOS”);//You can use Android if you are running in an Android device.
capabilities.setCapability(“browserName”, “Safari”);//In case of Android, you can use Chrome as value for browserName.
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);//You can use AndroidDriver instead of IOSDriver if you are running on Android device.

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “Android GoogleAPI Emulator”);//You will get device details from Sauce Lab cloud.
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“platformVersion”, “10.0”);
capabilities.setCapability(“app”, “sauce-storage:my_app.apk”);//You need to upload the Android application .APK file into Sauce Labs repository. 
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “iPhone XS Simulator”);//You will get device details from Sauce Lab cloud.
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“platformVersion”, “13.2”);
capabilities.setCapability(“app”, “sauce-storage:my_app.zip”);//You need to upload the iOS application into Sauce Labs repository. 
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

5. TestingBot Cloud

    TestingBot has been providing one of the cloud-based Selenium and Appium and has been improving its service ever since. TestingBot providing access to over 2000 browsers and devices that you can instantly start using for Live and Automated testing. You need to register in TestingBot to get access to the TestingBot dashboard, Key, and Secret values. Following are the important desired capabilities:

You will get KEY and SECRET from https://testingbot.com/members/user/edit
String KEY= “YOUR_TESTINGBOT_KEY”;
String SECRET= “YOUR_TESTINGBOT_SECRET”;
String URL = “https:// ” + KEY+ “:” + SECRET+ “@hub.testingbot.com/wd/hub”;

Desired Capabilities for Web Application

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platform”, “WIN10”);//You will get platform details from TestingBot cloud
capabilities.setCapability(“browserName”, “IE”);
capabilities.setCapability(“version”, “11”);
capabilities.setCapability(“name”, “Web Test”);
driver = new RemoteWebDriver(new URL(URL), capabilities);

Desired Capabilities for Mobile Web

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);//You need to use Android in case if you are running the script on Android device.
capabilities.setCapability(“deviceName”, “iPhone 11”);//You will get device details from TestingBot cloud
capabilities.setCapability(“version”, “13.4”);
capabilities.setCapability(“browserName”, “safari”);//In case of Android, you have to use Chrome as browserName.
capabilities.setCapability(“name”, “Mobile Web Test”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);//You have to use AndroidDriver instead of IOSDriver if you are starting session on Android devices.

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“deviceName”, “Galaxy S10”);//You will get the device details from TestingBot cloud
capabilities.setCapability(“version”, “9.0”);
capabilities.setCapability(“app”, “tb://<hashed app-id>”);//You need to upload the APK into TestingBot repository and you will get the hashed_app_id
capabilities.setCapability(“name”, “Mobile Native Android Test”);
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“deviceName”, “iPhone 11”);//You will get the device details from TestingBot cloud
capabilities.setCapability(“version”, “13.4”);
capabilities.setCapability(“app”, “tb://<hashed app-id>”);//You need to upload the iOS app as ZIP format into TestingBot repository and you will get the hashed_app_id
capabilities.setCapability(“name”, “Mobile Native iOS Test”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

6. HeadSpin Device Farm 

       HeadSpin is a service that provides device farm, test automation environments, and monitoring the performance of mobile applications. You need to register in HeadSpin to get access to the device farm and the API token. Following are the important desired capabilities:

String HEADSPIN_APITOKEN = “your-api-token-here”;
String URL = “https://appium-dev.headspin.io/v0/ ” + HEADSPIN_APITOKEN + “/wd/hub”;

Desired Capabilities for Mobile Web – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“automationName”, “UiAutomator2”);
capabilities.setCapability(“deviceName”, “ANDROID_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“udid”, “ANDROID_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“browserName”, “chrome”);
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Web – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“deviceName”, “IOS_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“udid”, “IOS_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“browserName”, “safari”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“automationName”, “UiAutomator2”);
capabilities.setCapability(“deviceName”, “ANDROID_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“udid”, “ANDROID_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“appPackage”, “YOUR_APP_PACKAGE_NAME”);
capabilities.setCapability(“appActivity”, “YOUR_APP_ACTIVITY_NAME”);
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“deviceName”, “IOS_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“udid”, “IOS_DEVICE_UDID_FROM_HEADSPIN”);
capabilities.setCapability(“bundleID”, “YOUR_IOS_APP_BUNDLEID”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

7. Kobiton Mobile Device Cloud

      Kobiton enables developers and testers to perform automated and manual testing of mobile apps and websites on real devices. Kobiton allows for instant provisioning of real devices for testing with automated or manual scripts, and also allows current on-premise devices to be plugged in to form a holistic testing cloud. You need to register in Kobiton Cloud to get access to devices and the API key. Following are the important desired capabilities:

You will get USERNAME and API_KEY from https://portal.kobiton.com/settings/keys
String USERNAME = “YOUR_KOBITON_CLOUD_USERNAME”;
String API_KEY = “YOUR_KOBITON_CLOUD_API_KEY”;
String URL = “https:// ” + USERNAME + “:” + API_KEY + “@api.kobiton.com/wd/hub”;

Desired Capabilities for Mobile Web – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“deviceName”, “Galaxy A20”);//You will get device name details from Kobiton device cloud.
capabilities.setCapability(“platformVersion”, “9”);
capabilities.setCapability(“browserName”, “chrome”);
capabilities.setCapability(“deviceGroup”, “KOBITON”);
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Web – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“deviceName”, “iPhone XS”);//You will get device name details from Kobiton device cloud.
capabilities.setCapability(“platformVersion”, “12.4”);
capabilities.setCapability(“browserName”, “safari”);
capabilities.setCapability(“deviceGroup”, “KOBITON”);
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – Android

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“deviceName”, “Galaxy A20”);//You will get device name details from Kobiton device cloud.
capabilities.setCapability(“platformVersion”, “9”);
capabilities.setCapability(“deviceGroup”, “KOBITON”);
capabilities.setCapability(“app”, ” kobiton-store:<your_app_name>”);//You need to upload the application into Kobiton repository and assign kobiton-store:<your_app_name> value.
driver = new AndroidDriver<WebElement>(new URL(URL), capabilities);

Desired Capabilities for Mobile Native – iOS

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“deviceName”, “iPhone XS”);//You will get device name details from Kobiton device cloud.
capabilities.setCapability(“platformVersion”, “12.4”);
capabilities.setCapability(“deviceGroup”, “KOBITON”);
capabilities.setCapability(“app”, ” kobiton-store:<your_app_name>“);//You need to upload the application into Kobiton repository and assign kobiton-store:<your_app_name> value.
driver = new IOSDriver<WebElement>(new URL(URL), capabilities);

     I hope you got some knowledge of various digital labs and device farm. Try to utilize all the desired capabilities of various digital labs in your automation and enjoy the script execution in the cloud.

make it perfect!