For Demonstration Purposes Only
The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.
This repository will hold multiple examples on how to run Espresso tests on the Sauce Labs cloud. This can be on Android Emulators, Sauce Labs Android real devices or both at the same time, see example 8! More information on how to use it can be found below and in each folder.
- Please check our documentation for installing SauceCTL
- Make sure you've set up your credentials on your local machine and or CI-pipeline, see this-doc
- Check the Espresso-docs for all options
curl -L https://saucelabs.github.io/saucectl/install | bash
โ ๏ธ Make sure saucectl version is newer than v0.44.0
A prebuilt native Android application and it's Espresso test cases are included in this repo. Source to this application can be found on GitHub in this folder. The test-classes can be found here.
The application is bundled in mda-1.0.8-10.apk
and the tests cases are bundled in mda-androidTest-1.0.8-10.apk
.
All below mentioned examples can be found in the .sauce
-folder. You can run the configurations by running
the following command from the root of this folder
saucectl run --config ./.sauce/runner-ex{#}.yml
The #
stands for the number of the below mentioned examples.
runner-ex1.yml
provides a minimum configuration needed to run the Espresso tests.
In this example, all test cases are executed on a single, available device in sequential order.
runner-ex2.yml
provides a minimum configuration needed to run the Espresso tests.
In this example, there are two test cases executed on a single, available device in sequential order.
runner-ex3.yml
breaks apart the execution of the two test cases such that they can run in
parallel on separate devices that are available (ie., not in use) in the pool.
runner-ex4.yml
modifies the second example by specifying which device in the pool to execute
each test on. Still uses parallel execution.
runner-ex5.yml
uses the deviceNameQuery
capability to look for available devices using
wildcard names. This example demonstrates the ability to run a specified test(s) on a pool devices that are configured
the same but have different names for parallel processing.
runner-ex6.yml
uses only the platformVersion
field to select an available device.
Demonstrates the ability to pick a specific version of Android from the pool of devices for executing tests in parallel.
runner-ex7.yml
uses Espresso test annotation.
Demonstrates the ability to run four tests based on the @ErrorFlow
-annotation in a single class,
see here.
runner-ex8.yml
runs espresso tests on both Android Emulators AND Android Real Devices.
runner-ex9.yml
runs espresso all tests on multiple Android Real Devices and Android
Emulators by automatically sharding the tests. saucectl
automatically creates the sharded jobs for each of the devices
defined for the suite based on the number of shards you specify.