Based on the usage metrics of an application, clients usually ask us to test their application against most using devices, browsers by its customers. Maintaining all these sets of Operating systems, devices and other test assets will be a burden to both client and company. One solution to overcome the above problem is to use a third party Cloud services like Sauce Labs, Browser Stack etc. In this post will be knowing about Sauce Labs and how we can execute scripts against specific configuration.

Sauce Labs is a cloud platform which provides a comprehensive test infrastructure for automated and manual testing of desktop and mobile applications thus allowing users to run tests in the cloud on different browser platform, operating system and device combinations. For Mobile, Sauce Labs helps in automating Native, Hybrid and Mobile Web Apps across emulators, simulators and real devices.

sauce-labs_automation-factsTo run our test scripts in Sauce labs, we have to use Desired Capabilities and Remote WebDriver/AndroidDriver objects where the former one is used to set the commands like in which OS/Browser/Device/Version we have to use and the latter helps in pointing our tests to Sauce labs cloud, for this we need to create an account in Sauce labs.

Steps to get the SauceCloud Url:

  1. Create a free trial account in Sauce labs from
  2. Get the access key of the account created from as we need to pass Username and AccessKey in the Cloud Url
  3. Form the cloud Url with the following syntax “http://”+userName+ ” : ” +accessKey+””

The important pre-requisite to test any hybrid or native mobile application in Sauce Labs  is to upload the application you want to test to Sauce Storage (temporary storage area of Sauce labs) using SauceLabs REST API, and then access it for testing by specifying sauce-storage:<UploadedApp>  in the application desired capabilities in your test script.

Upload Files in Sauce-Storage:

We will use Curl commands to send App from our local machine to Sauce Storage in the following manner:

  1. Download the stable curl version from this link*
  2. Unzip the folder and set the path variable to /bin
  3. Enter the following command after setting the above path in command prompt:


curl -u <sauce_username>:<sauce_access_key> -X POST -H “Content-Type: application/octet-stream”<sauce_username>/<upload_filename&gt;?overwrite=true –data-binary @/<path/to/your_file_name>

where <upload_filename> refers to the name you want to use for the file under Sauce Storage. For example,  Snapdeal.apk  and

<path/to/your_file_name> refers to the path where the file is saved on your local system, for example F:\SnapDeal\sdqa\src\test\resources\Snapdeal.apk



4.  We can check for the uploaded app in SauceStorage by using the following command.





Note: Here Sauce Storage is a temporary storage area where it can store apps for Seven days. After seven days, all assets are cleared from your Sauce Storage and  we need to upload it again.

A Sample program to launch SnapDeal App in Saucelabs

Tests execution in Sauce Labs will be shown as follows: