Mobile Automation Testing in Sauce Labs

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.

To 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.

Form the cloud Url with the following syntax “http://”+userName+ ” : ” +accessKey+”@ondemand.saucelabs.com:80/wd/hub”

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: