Configuring Your Espresso Tests
saucectl
relies on a YAML specification file to determine exactly which tests to run and how to run them. To customize saucectl
to run your Espresso tests, simply modify the properties of the YAML file accordingly. This page defines each of the configuration properties specific to running Espresso tests.
Setting an Alternative Configuration File
By default, saucectl
looks for the config.yml
file in the .sauce
folder of your project root, but you can actually specify a different file, or if you are using multiple frameworks or need to configure different sets of tests to run separately, you may choose to have multiple configuration files that you can direct saucectl
to reference as necessary.
Use the following configuration at runtime to direct saucectl
to use any configuration file you choose:
saucectl run -c ./path/to/{config-file}.yml
While you can use multiple files of different names or locations to specify your configurations, each file must be a *.yml
and follow the saucectl
syntax. Our IDE Integrations (e.g., Visual Studio Code) can help you out by validating the YAML files and provide handy suggestions, so make sure to check them out!
Example Configuration
loading...
Each of the properties supported for running Espresso tests through saucectl
is defined below.
apiVersion
| REQUIRED | STRING |
Identifies the version of the underlying configuration schema. At this time, v1alpha
is the only supported value.
apiVersion: v1alpha
kind
| REQUIRED | STRING/ENUM |
Specifies which framework is associated with the automation tests configured in this specification.
kind: espresso
showConsoleLog
| OPTIONAL | BOOLEAN |
Controls whether the contents of console.log
are always shown in the local output of saucectl. By default (false), console.log
is only shown for failed suites.
showConsoleLog: true
defaults
| OPTIONAL | OBJECT |
Specifies any default settings for the project.
defaults:
timeout: 15m
timeout
| OPTIONAL | DURATION |
Instructs how long (in ms
, s
, m
, or h
) saucectl
should wait for each suite to complete. You can override this setting for individual suites using the timeout
setting within the suites
object. If not set, the default value is 0
(unlimited).
When setting the timeout values for your suites, consider that native framework tests on real devices enforce a maximum test duration limit of 90 minutes.
timeout: 15m
sauce
| OPTIONAL | OBJECT |
The parent property containing all settings related to how tests are run and identified in the Sauce Labs platform.
sauce:
region: eu-central-1
metadata:
tags:
- e2e
- release team
- other tag
build: Release $CI_COMMIT_SHORT_SHA
concurrency: 5
region
| OPTIONAL | STRING/ENUM |
Specifies through which Sauce Labs data center tests will run. Valid values are: us-west-1
or eu-central-1
.
If you do not specify a region in your config file, you must set it when running your command with the --region
flag.
region: eu-central-1
metadata
| OPTIONAL | OBJECT | VIRTUAL ONLY |
The set of properties that allows you to provide additional information about your project that helps you distinguish it in the various environments in which it is used and reviewed, and also helps you apply filters to easily isolate tests based on metrics that are meaningful to you, as shown in the following example:
metadata:
build: RC 10.4.a
tags:
- e2e
- Android
- beta
- featurex
concurrency
| OPTIONAL | INTEGER |
Sets the maximum number of suites to execute at the same time. If the test defines more suites than the max, excess suites are queued and run in order as each suite completes.
Set this value to equal or less than your Sauce concurrency allowance, as setting a higher value may result in jobs dropped by the server.
concurrency: 5
Alternatively, you can override the file setting at runtime by setting the concurrency flag as an inline parameter of the saucectl run
command:
saucectl run --ccy 5
retries
| OPTIONAL | INTEGER |
Sets the number of times to retry a failed suite. For more settings, you can refer to passThreshold.
retries: 1
Alternatively, you can override the file setting at runtime by setting the retries flag as an inline parameter of the saucectl run
command:
saucectl run --retries 1
tunnel
| OPTIONAL | OBJECT |
saucectl
supports using Sauce Connect to establish a secure connection with Sauce Labs. To do so, launch a tunnel; then provide the name and owner (if applicable) in this property.
sauce:
tunnel:
name: your_tunnel_name
owner: tunnel_owner_username
name
| OPTIONAL | STRING |
Identifies an active Sauce Connect tunnel to use for secure connectivity to the Sauce Labs cloud.
This property replaces the former id
property, which is deprecated.
sauce:
tunnel:
name: your_tunnel_name
owner
| OPTIONAL | STRING |
Identifies the Sauce Labs user who created the specified tunnel, which is required if the user running the tests did not create the tunnel.
This property replaces the former parent
property, which is deprecated.
sauce:
tunnel:
name: your_tunnel_name
owner: tunnel_owner_username
visibility
| OPTIONAL | STRING |
Sets the visibility level of test results for suites run on Sauce Labs. If unspecified or empty, team
visibility will be applied. Valid values are:
This property is only valid for tests run against Emulators. It has no effect on tests run against real devices.
public
: Accessible to anyone.public restricted
: Share your job's results page and video, but keeps the logs only for you.share
: Only accessible to people with a valid link.team
: (Default) Only accessible to people under the same root account as you.private
: Only you (the owner) will be able to view assets and test results page.
sauce:
visibility: private
launchOrder
| OPTIONAL | STRING |
Specifies the execution order for your test suites. When set to fail rate
, test suites with the highest failure rate will execute first. If unspecified, test suites will execute in the order in which they are written in the configuration file.
sauce:
launchOrder: fail rate
reporters
| OPTIONAL | OBJECT |
Configures additional reporting capabilities provided by saucectl
.
reporters:
junit:
enabled: true
filename: saucectl-report.xml
spotlight
| OPTIONAL | OBJECT |
The spotlight reporter highlights failed or otherwise interesting jobs. It may include an excerpt of failed tests or other information that may be useful for troubleshooting.
reporters:
spotlight:
enabled: true
junit
| OPTIONAL | OBJECT |
The JUnit reporter gathers JUnit reports from all jobs and combines them into a single report.
reporters:
junit:
enabled: true
filename: saucectl-report.xml
json
| OPTIONAL | OBJECT |
The JSON reporter gathers test results from all jobs and combines them into a single report.
reporters:
json:
enabled: true
filename: saucectl-report.json
webhookURL: https://my-webhook-url
enabled
| OPTIONAL | BOOLEAN |
Toggles the reporter on/off.
enabled: true
webhookURL
| OPTIONAL | STRING |
Specifies the webhook URL. When saucectl test is finished, it'll send an HTTP POST with a JSON payload to the configured webhook URL.
webhookURL: https://my-webhook-url
filename
| OPTIONAL | STRING |
Specifies the report filename. Defaults to "saucectl-report.json".
filename: my-saucectl-report.json
artifacts
| OPTIONAL | OBJECT |
Specifies how to manage test output, such as logs, videos, and screenshots.
artifacts:
cleanup: true
download:
when: always
match:
- junit.xml
directory: ./artifacts/
cleanup
| OPTIONAL | BOOLEAN |
When set to true
, all contents of the specified download directory are cleared before any new artifacts from the current test are downloaded.
cleanup: true
download
| OPTIONAL | OBJECT |
Specifies the settings related to downloading artifacts from tests run by saucectl
.
download:
when: always
match:
- junit.xml
directory: ./artifacts/
when
| OPTIONAL | STRING |
Specifies when and under what circumstances to download artifacts. Valid values are:
always
: Always download artifacts.never
: Never download artifacts.pass
: Download artifacts for passing suites only.fail
: Download artifacts for failed suites only.
when: always
match
| OPTIONAL | STRING/ARRAY |
Specifies which artifacts to download based on whether they match the name or file type pattern provided. Supports the wildcard character *
(use quotes for best parsing results with wildcard).
match:
- junit.xml
- "*.log"
directory
| OPTIONAL | STRING |
Specifies the path to the folder location in which to download artifacts. A separate subdirectory is generated in this location for each suite for which artifacts are downloaded. The name of the subdirectory will match the suite name. If a directory with the same name already exists, the new one will be suffixed by a serial number.
directory: ./artifacts/
espresso
| REQUIRED | OBJECT |
The parent property containing the details specific to the Espresso project.
espresso:
app: ./apps/calc.apk
appDescription: My demo app
testApp: ./apps/calc-success.apk
testAppDescription: My test app
otherApps:
- ./apps/pre-installed-app1.apk
- ./apps/pre-installed-app2.apk
app
| REQUIRED | STRING |
Specifies a local path, URL, or storage identifier to the app under test. This property supports expanded environment variables.
When defining a local path, the default directory is {project-root}/apps/filename.apk
. The app will be uploaded to the Sauce Labs storage service. Supports *.apk
and *.aab
files.
When defining a URL to your app, it will be downloaded to a local temporary directory before being uploaded to Sauce storage.
To install an *.apk app that is extracted from an *.aab file, Sauce Labs must sign the *.apk using its own signature. In such cases, Sauce Labs signs both the app
and testApp
to ensure matching signatures, even if instrumentation is disabled. Otherwise, the app installation will fail.
app: ./apps/calc.apk
app: https://example.app.download.url/calc.apk
app: $APP
app: storage:099557f6-aabb-f8b3-6ad1-8f6200898b92
app: storage:filename=calc.apk
appDescription
| OPTIONAL | STRING |
Specifies description for the uploaded app.
appDescription: My demo app
testApp
| REQUIRED | STRING |
Either a local path, url, or storage identifier to the testing app. This property supports expanded environment variables.
When defining a local path, the default directory is {project-root}/apps/testfile.apk
. The app will be uploaded to the Sauce Labs storage service. Only supports *.apk
files.
When defining a url to your test app, it will be downloaded to a local temporary directory before being uploaded to the storage service.
testApp: ./apps/calc-success.apk
testApp: https://example.app.download.url/calc-success.apk
testApp: $TEST_APP
testApp: storage:fbd59e8e-2555-0d3c-5583-1bba2cd17b64
testApp: storage:filename=calc-success.apk
testAppDescription
| OPTIONAL | STRING |
Specifies description for the uploaded testApp.
testAppDescription: My test app
otherApps
| OPTIONAL | ARRAY | REAL DEVICES ONLY |
Set of up to seven apps to pre-install for your tests. You can upload an *.apk
or *.aab
app file from your local machine by specifying a filepath (relative location is {project-root}/apps/app1.apk
), a remote url, or you can specify an app that has already been uploaded to Sauce Labs App Storage by providing the reference storage:<fileId>
or storage:filename=<filename>
.
Apps specified as otherApps
inherit the configuration of the main app under test for Device Language
, Device Orientation
, and Proxy
, regardless of any differences that may be applied through the Sauce Labs UI, because the settings are specific to the device under test. For example, if the dependent app is intended to run in landscape orientation, but the main app is set to portrait, the dependent app will run in portrait for the test, which may have unintended consequences.
otherApps:
- ./apps/pre-installed-app1.apk
- https://example.app.download.url/pre-installed-app1.apk
- $PRE_INSTALLED_APP2
- storage:d6aac80c-2000-a2f1-4c4e-539266e93ee6
- storage:filename=pre-installed-app3.apk
suites
| REQUIRED | OBJECT |
The set of properties providing details about the test suites to run. May contain multiple suite definitions. See the full example config for an illustration of multiple suite definitions.
You can configure tests for both Real Devices and Virtual Machines in a single configuration file.