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!

Speed Up iOS Appium Test Automation

vector-frameworks-appium_2x

     Appium users have the question like how to speed up the iOS tests, citing the length of time it takes to start tests which use the WebDriverAgent library (all tests using the XCUITest driver).

     Most of the perceived speed of an Appium test can’t be improved due to the base speed of booting devices or the UI actions themselves. The slowest part, which users were asking how to avoid, is the initial startup of a test: the time between sending the first POST /session command and the response indicating that your test script can begin sending commands. We can call this time period the “session creation” time.

     There are desired capabilities we can specify to greatly reduce the time it takes to create a session. Appium is built to cater to a large number of devices, for use in many different situations, but we also want to make sure that it is easy to get started automating your first test. When specifying desired capabilities, Appium will analyze the state of your system and choose default values for every desired capability which you don’t specify. By being more specific, we can have Appium skip the work it does to choose the default values.

     Our first improvement is to set the app location to a file already on the host device. Then you can directly use the bundleId 

caps.setCapability(“bundleId”, “io.test.app”);

      Please ignore the remote path of your application in the code instead of that you can use the local application path, once it gets installed on the device avoid the local path and stick to use bundleId

     Running the tests, it’s easy to notice that the app gets reinstalled on the device for each test. This takes a lot of time and can be skipped. You may have certain tests which require a fresh install or need all the app data cleaned, but those tests could be put into a separate suite, leaving the majority of tests to run faster by reusing the same app. Most users should be familiar with the noReset desired capability.

 caps.setCapability(“noReset”, true)

    Appium uses the simctl command-line tool provided by Apple to match the deviceName desired capability to the udid of the device. We can skip this step by specifying the device udid ourselves.

caps.setCapability(“udid”, “009D802528AB4A1BA7C885A9F6FDBE95”);

      When loading the WedDriverAgent server, Appium loads the files from wherever XCode saved it after compilation. This location is called the “Derived Data Directory” and Appium executes an xcodebuild command in order to get the location. Below desired capability derivedDataPath allowing Appium to skip the work of calculating it:

caps.setCapability(“derivedDataPath”, “/Users/sanojs/Library/Developer/Xcode/DerivedData/WebDriverAgent-apridxpigtzdjdecthgzpygcmdkp”);

     The last optimization is to specify the webDriverAgentUrl desired capability. If specified, Appium skips a step where it checks to make sure that there are no obsolete or abandoned WebDriverAgent processes still running. The WebDriverAgent server needs to already be running at this location, so we can only use this desired capability after the first test starts the server.

caps.setCapability(“webDriverAgentUrl”, “http://localhost:8100&#8221;);

       I hope the above tips will help you to speed up the iOS automation using Appium. Please try to change your Desired Capability today to get a better speed of automation on the iOS platform.

Refer the tips to improve the speed for Android @https://journeyofquality.wordpress.com/category/speed-up-android-appium-test-automation/

Reference: Appium Pro

make it perfect!

Automation with SeeTest Cloud

image2016-3-15 12_13_22

     From my experience with automation execution on Cloud tools, I had done the executions with Perfecto Cloud, Sauce Labs, Browserstack; now am with SeeTest Cloud. In SeeTest Cloud, easily run your Selenium and Appium tests against real iOS, Android & desktop browsers, ensuring that you are testing real user scenarios accurately.

       Start testing mobile and web applications on the cloud. It will support both manual and automation tests. Allows you to easily create automated tests for your mobile application using our large selection of real iOS and Android.

     Here I would like to share what are the capabilities required to execute your automation scripts in SeeTest Cloud for Mobile Native (iOS and Android), Mobile Web (iOS and Android) and Desktop Browsers. Before start setup the capabilities and script execution, you need a account in SeeTest Cloud. For the account, you need to register with SeeTest Cloud (https://cloud.seetest.io/) and get the access key, specify the access key in the set of test capabilities to gain access to remote testing. Once the access key ready, you can set the Desired Capabilities and instantiate the driver for Automation scripts. Following steps helps to get the access key from your registered SeeTest Cloud account,

In the cloud, click on your profile → Get Access Key

Capture.PNG

For Mobile Native - Android

AndroidDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "Android Mobile Native Test Execution"); 
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='android'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setCapability(MobileCapabilityType.APP, "application_location_in_SeeTest"); 
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "application_package_name"); 
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "application_activity_name"); 
driver = new AndroidDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Native - iOS

IOSDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "iOS Mobile Native Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='ios'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device_OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setCapability(MobileCapabilityType.APP, "application_location_in_SeeTest Cloud"); 
dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "Bundle_ID of the application");
driver = new IOSDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Web - Android

AndroidDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "Android Mobile Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='android'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device_OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setBrowserName(MobileBrowserType.CHROMIUM);
driver = new AndroidDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Web- iOS

IOSDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("testName", "iOS Mobile Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='ios'");
dc.setCapability("deviceModel", "device_name");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "selected_device_OS_version");
dc.setCapability(MobileCapabilityType.UDID, "device_UDID");
dc.setBrowserName(MobileBrowserType.SAFARI);
driver = new IOSDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Desktop Web

WebDriver driver;
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("testName", "Desktop Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability(CapabilityType.PLATFORM, "desktop_OS_name"); 
dc.setCapability(CapabilityType.BROWSER_NAME, "name of the browser"); 
dc.setCapability(CapabilityType.VERSION, "browser_version");
driver = new RemoteWebDriver(new URL("https://cloud.seetest.io/wd/hub"), dc);

Now, the capabilities and driver is ready, next you can start writing your automation scripts and execute it on SeeTest Cloud.

make it perfect !

 

Appium Desired Capabilities for Android and iOS

Screen-Shot-2016-09-28-at-11.03.39-AM

     Most of the time I observed that people facing the issues at the initial stage of running their automation scripts due to lack of knowledge in the selection of Desired Capabilities based on their Automation platform. Here, I would like to explain important Desired Capabilities for following:

  • Mobile Web Android
  • Mobile Web iOS
  • Mobile Native Android
  • Mobile Native iOS

Mobile Web Android
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “name of your test device”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “OS version of your test device”);
capabilities.setCapability(“udid”, “UDID of your test device”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “Chrome”);

Mobile Web iOS
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “name of your test device”);
capabilities.setCapability(“udid”, “UDID of your test device”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.SAFARI);
capabilities.setCapability(nativeWebTap, true);
capabilities.setCapability(“startIWDP”, true);
capabilities.setCapability(IOSMobileCapabilityType.START_IWDP, true);
capabilities.setCapability(“app”, “path of SAFAILAUNCHERAPPPATH”);
//SAFAILAUNCHERAPPPATH = “/usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/build/SafariLauncher/SafariLauncher.app”
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“realDeviceLogger”, “path of DEVICECONSOLEPATH”);
//DEVICECONSOLEPATH=”/usr/local/lib/node_modules/deviceconsole/deviceconsole”

Mobile Native Android
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “name of your test device”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “OS version of your test device”);
capabilities.setCapability(MobileCapabilityType.UDID, “UDID of your test device”);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
capabilities.setCapability(MobileCapabilityType.APP, “location of your .APK”);
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, “package name of your Android application”);
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, “activity name of your Android application”);

Mobile Native iOS
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “name of your test device”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “OS version of your test device”);
capabilities.setCapability(MobileCapabilityType.UDID, “UDID of your test device”);
capabilities.setCapability(MobileCapabilityType.APP, “location of your .iPA or .APP”);
capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, “bundle ID of your iOS application”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“realDeviceLogger”, “path of DEVICECONSOLEPATH”);
//DEVICECONSOLEPATH=”/usr/local/lib/node_modules/deviceconsole/deviceconsole”

     Once you set your Desired Capabilities, next need to instantiate the drivers for Android and iOS in the following way:

For Android
WebDriver driver;
driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub&#8221;), capabilities)

For iOS
WebDriver driver;
driver = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub&#8221;), capabilities)

Try to use above mentioned Desired Capabilities in your automation scripts.

make it perfect !