Document toolboxDocument toolbox

Execution on Sauce Labs Real Device-TestObject

Introduction

The Sauce Labs Real Device-TestObject provides you the ability to run Qualitia test cases across Android and iOS physical devices. With its Web interface, you can run tests using different combinations of platforms, platform versions, and browsers. In this environment all Qualitia mobile application tests are executed on physical devices. Sauce Labs allows you viewing video recordings of the test case executions.

To know more about Sauce Labs click here.

Prior 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

After you develop your test cases in Qualitia Automation Studio for Web and Mobile and add them in Suites, you can create an offline package to execute them on the Sauce Labs Real Devices. In order to do so, you must configure property files from the offline package accordingly.

  1. Navigate to the folder where you have saved your offline package.
  2. Open the config folder.
  3. Edit the qualitia.properties file.
  4. Do one of the following: 
    1. If the test case belongs to Mobile application, go to the Mobile Execution Properties section:
      1. Set MobileExecutionEnvironment to TESTOBJECT
        or
    2. If the test case belongs to Web application, go to the Mobile Execution Properties section:
      1. Set DefaultWebExecutionPlatform as Mobile and 
      2. Set MobileExecutionEnvironment to TESTOBJECT 
      3. Set ScreenCaptureMode to Browser
  5. Save changes and close the file.

Creating a Real Device Project

In order to automate testing on Sauce Labs Real Device, you must create a project on TestObject. When creating a project, you provide information about the type of application to test (Web or Mobile app) and the device settings you want to use in your tests. After creating a project, you will get a testobject_api_key (for example: 1234567890123456789012345678901234567890). You will have to add this key in testobject.properties against to.testobject_api_key property.

For more information about creating the project for Sauce Labs Real Device testing, refer to the Sauce Labs documentation.

Configuring testobject.properties

In order to execute mobile application test cases on Sauce Labs Real Devices, you must configure the testobject.properties file accordingly.

This file is located in the config folder of Qualitia offline package.

  1. Navigate to the folder where you have saved Qualitia offline package.
  2. From the config folder, open the testobject.properties file.
  3. Set to.url to a valid Endpoint URL.
    For example: EU: https://eu1.appium.testobject.com/wd/hub US: https://us1-manual.app.testobject.com/wd/hub
  4. Set to.testobject_api_key to a valid key.
  5. Set to.platformName to a valid platform.
  6. Set to.deviceName to allocate a device using its device name.
    For example: iPhone 6, LG G6, Samsung Galaxy S7, and so forth.
  7. Set to.testobject_app_id to a valid app ID.
    (info) This decides which version of the application from the repository to consider when automating test cases.
  8. Set to.testobject_session_creation_timeout in milliseconds. Based on the value you set here, Qualitia waits for the device to be available (in case the device is busy when execution of test case is triggered).

Qualitia Bot - Execution

After you configure all the files, you can trigger the test case execution by opening the command prompt and navigating to the folder where you saved the Qualitia bot. After navigating to the designated folder: execute the following command;

java -jar qualitiaoffline-xxx.jar

This command executes tests available at the xmlPath mentioned in the qualitia.properties file.

(warning) In case you have multiple versions of java, Qualitia uses the version set against the "JAVA_HOME" system variable under System Properties settings of your computer.

Viewing Test Case Execution and Reports 

Once you trigger the offline package execution, you can view the status of your ongoing executions in Appium Test Results section. Each Test or Suite appears as a single grid with details like device, time, and duration of the test execution against it. Click the test case name from the list to view detailed logs, video recordings, and so forth of the test case.

To view the execution report of Qualitia test cases:

  1. Log on to your Sauce Labs real device instance.
  2. From the top, click  > Appium.
  3. In the Appium Test Results section, click the test case from the list.
    Here you can view the Test case Info, Screenshots, Video, Requests, Device Logs and Appium Logs.

Different Ways of Setting Properties

The values you provide in default property files (qualitia.properties, testobject.properties, and so forth) can also be provided using user-defined properties file and command line interface as follows: 

1.

Default Property Files (from the config folder of offline package)

This is the set of default TestObject properties. You can always use this file to add valid values.

2.

User Defined TestObject Properties

You can create your own file with the set of properties and use when executing test cases in the TestObject environment. These are called user defined property files. This gives you provision to override the property values given in the default property files (for example: testobject.properties).  

For example:

  • java -jar qualitiaoffline-x.x.x.jar testobjectfilename="D:\\TestObject\\TestObject_version01.properties"
3.

Command Line Arguments

Along with the two options mentioned above, you can also provide the properties using command line interface. Values provided using the command line interface override all the values provided in the default property files (such as testobject.properties) and user defined properties file. In order to provide arguments from the command line interface, you must enter values in following syntax.

For example: java -jar qualitia-offline-xxxx.jar to.platformName=Android, to.testobject_app_id=12

The command mentioned above overrides all the values provided in default property files (testobject.properties) and user defined property file (if any).