Skip to end of metadata
Go to start of metadata

With Sauce Runner for Real Devices, you can run tests using the Espresso and XCUITest frameworks, run tests in parallel across multiple devices, and run subsets of tests against specific devices. This topic describes the options you can use with the runner. You can set the options as environment variables that can be referenced in your testing scripts, or pass them as command line parameters, which will take precedence over options set as environment variables. You can also create a runner configuration file with the options and commands for running your tests. 

General Usage

JAVA_HOME=$(/usr/libexec/java_home --version 8) java -jar runner.jar  <options> <command> <command options>

Options

Using Sauce Runner with a Proxy

 If you need Sauce Runner to connect to the internet through a proxy server, use the -D command to specify a direct domain connection to your proxy server and port. The parameters http.proxyUser and http.proxyPassword are optional and they can be used if the proxy needs authentication:

java -Dhttp.proxyHost=<your proxy server> -Dhttp.proxyPort=<the port to use> -Dhttp.proxyUser=<the username to use> -Dhttp.proxyPassword=<the password to use>
RequiredOptionDescription
X--testFrameworkThe test framework to use for your tests, either xcuitest or android.
X--apikeyThe API key for your Sauce Labs real device cloud account.
X--appThe path to the *.ipa or *.apk file of the application under test or the id number of an already uploaded app.
X--testThe path to the *.ipa or *.apk file of the test or the id number of an already uploaded test.
X--datacenter

The data center, either in the US or EU, to use in your tests. If you don't specify a device or devices for your test, one will be assigned to your tests based on the type of application you're testing against.

Values: EU or US


--deviceFor static allocation of a device, provide the ID for the type of device to use in your tests, such as 'iPhone_5_real'. You can find the IDs for devices on the Live Testing page in the Sauce Labs web interface. Under the Real Devices tab, search for the type of device you want to use, and then click the Details link in the device description to see the device ID.

--devicesThe list of devices, allocated dynamically or through static description of the device ID, to use in your tests. Check out Examples of Device Specifications for the Real Device Runner for more information.

--testname

Set a custom test name to appear on the UI, Default is Test.


--tunnelIdentifierIf you are using Sauce Connect Proxy, provide the identifier of the tunnel you want to use.

--checkFrequencyInterval in seconds to check test results. Default is 30.

--timeoutTest timeout in minutes.  Test duration cannot exceed 60 minutes. Defaults to 60.

--xmlFolderThe folder for the JUnit XML output.

--urlProvide the URL of an alternative REST endpoint to use. Default is https://app.testobject.com/api/rest.

--platformVersionFor dynamic allocation of a device, provide an operating system version to use. For example, use '9' to allocate a device running major version 9 and arbitrary versions of the OS, or '9.3.3' for a specific version.

--privateDevicesOnly

If set, only private devices will be queried.


--phoneOnly

If set, only phones will be queried.


--tabletOnly

If set, only tablets will be queried.


--deviceNameQuery

For dynamic allocation of a device, provide the device name you would like to dynamically allocate. For example, use 'iPhone.*Plus' to allocate any iPhone Plus device


--testsToRun

XCUITest Only!

Provide a comma separated list of test cases or test classes. If you want to run all tests of a class provide only the classname and if you want to run a specific method of a class provide the class name and method name separated with a '/' (e.g. '--testsToRun ClassA,ClassB/methodC' runs all tests in 'ClassA' and only 'methodC' of 'ClassB')


Example

--testsToRun ClassA,ClassB/methodC


--useTestOrchestrator

Espresso Only!

If set, the instrumentation will start with Test Orchestrator version 1.1.1 in use. Supported on runner version 1.7 and newer.

Note that with Test Orchestrator it is in most cases recommended to also add the "--e clearPackageData true" parameter To remove all shared state from your device's CPU and memory after each test.


--e

Espresso Only!

Provide a list of test options to Espresso. The key-value pairs supported by espresso are documented here: https://developer.android.com/studio/test/command-line#AMOptionsSyntax. In the example, the test would execute all test methods defined in the class com.example.android.TestClassA and the test method methodName defined in com.example.android.TestClassB.


Example - Execute all tests in class TestClassA

--e class com.example.android.TestClassA


Example - Execute a specific test in class TestClassB

--e class com.example.android.TestClassB#methodName

XCUITest Example with All Required Parameters and Setting the Data Center Option to US

java -jar runner.jar xcuitest --test DummyTestingApp-Runner.ipa --app DummyTestingApp.ipa --apikey <apikey> --datacenter US

Espresso Example with all Required Parameters and Setting the Data Center Option to US

java -jar runner.jar espresso --test DummyTestingApp-Runner.apk --app DummyTestingApp.apk --apikey <apikey> --datacenter US
  • No labels