Document toolboxDocument toolbox

Execution on Sauce Labs

Introduction

Sauce Labs is a cloud environment which allows users to run tests in the cloud using different combinations of operating systems, browsers, and browser versions. In this environment all tests are executed on Sauce Labs VM. You can view the ongoing suite execution on Sauce Lab's Dashboard.

To know more about Sauce Labs click here.

Prior to starting offline execution on Sauce Labs, ensure you have;

  • An active account with valid user name / password and
  • Sufficient balance of execution hours.

In this section

Configuring qualitia.properties

To execute test cases using Sauce Labs, you need to configure the qualitia.properties file accordingly. 

To execute the offline package using the Sauce Labs environment:

  1. Open the qualitia.properties file from the config folder of the offline package.
  2. Set xmlPath to the location where your test case execution XMLs (including Suite.xml and Map.xml) are stored.
  3. Set LogPath to the folder where you want to store your test cases results.
  4. Do one of the following:
    1. If you are testing desktop application, set ExecutionEnvironment as sauce or
    2. If you are testing mobile application, set MobileExecutionEnvironment as sauce.
  5. Set DefaultWebExecutionPlatform as follows:
    1. If you are testing desktop application, set it as Desktop or
    2. If you are testing mobile application, set it as Mobile.

Web Application Testing

When the Application under Test is a Web application and you want to execute the offline package in Sauce Labs environment, you need to configure the sauce.properties file accordingly.

To update the sauce.properties file:

  1. Open the sauce.properties file.
  2. Set properties "custom_username", "custom_accesskey" to valid values with reference to Sauce Lab's active user account.
  3. Set "platform", "browser", and "version" to the corresponding OS, browser, and browser version you want your offline package to execute on.
    For example, if you want your offline package to execute on Internet Explorer 11 on OS Windows 8.1 then set the keys as follows:
    • platform=Windows 8.1
    • browser=Iexplore
    • version=11

If you are providing these values through command line, each value should be provided within double quotes if values are containing spaces; otherwise, the spaces in values will result in inconsistencies. For example, java -jar Qualitia-Offline-xxx.jar platform="Windows 8.1".

For more information on platforms, browsers, browser versions supported on Sauce, please refer https://saucelabs.com/platforms/.

If you do not set these values against platform in the sauce.properties file, all your test cases will be executed on default OS. Also, if you do not specify the version, test cases will be executed using the latest version of browsers.

Mobile Application Testing

When the Application under Test is a mobile application and you want to execute the offline package in the Sauce Labs environment, you need to configure the saucemobile.properties file accordingly.

To update the saucemobile.properties file:

  1. Open saucemobile.properties file.
  2. Set properties "custom_username", "custom_accesskey" to valid credentials with reference to Sauce Lab's active user account.
  3. Set "browserName", "deviceName", "platformVersion", "appiumVersion", "deviceOrientation" and so forth to corresponding browser, device, platform, Appium, and Orientation of device you want your offline package to execute on. For example, if you want to execute your offline package on Samsung Galaxy S4 Device that has Android 6.0 operating system using Appium version 1.6.4, then set keys as follows:
    • browserName=[Keep it blank for native application or specify the browser name for Web applications]
    • deviceName=Samsung Galaxy S4 Device
    • platformVersion=6.0
    • appiumVersion=1.6.4
    • deviceOrientation=Portrait

Users should not specify UDID when executing test cases on mobile devices on Sauce Labs.

  • For more information about property possible values, refer the saucemobile.properties file.
  • You can use the Platform Configurator maintained by Sauce Labs to get the exact values of properties to set in the configuration files. Open Platform Configurator, select the properties based on which you want to configure your device on Sauce Labs and you will find the list of properties to be set in the configuration file at the end of page.
  • If you are providing these values through command line, each value should be provided within double quotes if values are containing spaces; otherwise, the spaces in values will result in inconsistencies. For example, java -jar Qualitia-Offline-xxx.jar platform="Windows 8.1".
    For more information on platforms, browsers, browser versions supported on Sauce, please refer https://saucelabs.com/platforms/.
  • If you do not specify the version of browsers, test cases will be executed using the latest version of browsers.


4. Set the "custom_mobileAppPathType" as follows:

  • When the application is to be uploaded from local drive, set it to Upload or
  • When the application is to be taken from public URL such as Google Drive, DropBox, set it to PublicURL.

Once all the configuration settings are done successfully, you can now execute test cases on Sauce Labs.

Executing Offline Package

You can execute the offline package following the traditional method of offline execution.

For more information on execution of offline package, please refer to the Offline Package - Execution section.

Values you provide in the sauce.properties file can also be provided using command line. You can set the sauce properties using three different sources as mentioned below.

sauce.properties

It is a set of default Sauce properties file. You can always use this file to define your own set of properties.

User Defined Sauce Properties

Qualitia users can create their own properties file for Sauce Labs, which includes all the Sauce Labs properties. This file can be used by providing command line arguments accordingly when executing offline package.
For example: java -jar qualitiaoffline-x.x.x.jar saucefilename="D:\\SauceLabsData
Saucelabs_version01.properties"

Command Line Arguments

Qualitia allows providing Sauce properties as command line arguments. For example, java -jar qualitia-offline-xxxx.jar custom_username=<<sauce user name>> platform=MAC recordVideo=false

Viewing Current Execution on Sauce Lab's Dashboard

Once you have triggered the offline execution, you can view the status of your ongoing executions on the Sauce Lab's Dashboard. Each test case appears on dashboard as a single job with execution status against it. All the test cases are taken one by one by the sequence they are arranged in Suite. The status is updated after each test execution is completed on Sauce Lab environment with its status (fail / pass) against it. You can view the execution of test case clicking the current job on Dashboard.

You can record your test case execution configuring the sauce.properties file accordingly.

Set the recordVideo value as true and all the test case executions will be recorded.

You can download these videos once the test execution is completed from the Metadata tab. The video contains the execution of all the test cases available in Suite as the value set against QualitiaExecMode in the qualitia.properties file is PS (refers to per suite).

Execution Reports

Test execution reports are launched on the machine from where the execution was triggered after the test case execution is completed. You can also download the video of test case execution from the Metadata tab.

Execution of Tests Running Behind Firewall (on Private Networks)

Few applications are configured to be accessed using private networks. Such applications deny access when they are being accessed from other than local networks and so from Sauce Lab. Executing test cases on Sauce for such applications needs special configurations.

You need to execute the sc.exe file some machine in the private network to allow Sauce executing tests flawlessly.

Executing this sc.exe will create a tunnel allowing sauce to execute test cases in the private network. 

To execute applications of private network on Sauce:

  1. Open the sauce.properties file from the config folder of Qualitia offline package.
  2. Set the desired value for slw.tunnelIdentifier.
    The value set here for this key will be required when executing sc.exe in step 6. For more information on configuring this property, refer Sauce Labs documentation.
  3. Download the Sauce Connect Proxy on any machine in the network using following url: 
    https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy
  4. Extract the folder at the suitable location.
    You will find the sc.exe file in the bin folder.
  5. Open Command Prompt and navigate to the folder where sc.exe file exists. 
  6. Enter the following command.

    sc -u <sauce_username> -k <accesskey> -i <tunnelID>
    For example: sc -u john.doe -k 8becc95c-4559-4582-a617-7d38544797a2 -i tunnel-1232
  7. Press Enter.

Once the SC.exe file is executed successfully, you can execute your offline tests on Sauce environment using the same method mentioned above.

Execution using Browser Capabilities

You can also execute test cases on remote environment using selenium supported Browser Capabilities.

For more information on this, please refer to the Execution using Browser Capabilities section.

Executing Test Cases on iOS Devices

If you are executing test cases on iOS mobile devices using Sauce Labs, you need to configure settings in the iosdc.properties file accordingly.

  • If iOS device is 9.3.x and below, automationname should be Appium or
  • If iOS device is 10.0.x and above, automationname should be XCUITest.

Execution using W3C Protocols

W3C-compliant Selenium capabilities and protocol is supported for test case executions in the Sauce Labs environment with selenium v3.11.0 and above.

This W3C protocol is supported while executing test cases using following browser versions:

  • Internet Explorer v11 and above,
  • Mozilla Firefox v53 and above, and
  • Google Chrome v 61 and above.

You'll need to make a few changes to the desired capabilities in the sauce.properties file to execute your existing Qualitia test cases using these new W3C capabilities.

Here is the list of capabilities which you need to modify when you want to execute test cases using W3C protocol. 

slw.useW3C=True
browser=Firefox, Chrome, or Internet Explorer)
version=(for firefox, 53 and above, for chrome 61 and above, for IE 11 and above)
seleniumVersion=3.11.0

For more information about executing test cases using W3C-Protocols and Capabilities, refer to the Sauce Labs documentation

Not finding what you need?