Espresso and XCUITest on Sauce Labs
Sauce Labs uses its framework agnostic test orchestrator
saucectl to execute Espresso and XCUITest tests based on one or more configuration files that instruct
saucectl to run your tests exactly the way you specify. Results get published in your Sauce Labs account, where you can compare 30 days of results across different environments and frameworks all in one view.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
- Your Sauce Labs Username and Access Key
- Your Espresso apps and files for real devices and/or emulators
- Your XCUITest apps and files for real devices (automated tests for simulators are not supported at this time)
Installation & Setup
saucectl can execute both Espresso and XCUITest tests, so the set up steps are the same regardless of which framework you are using.
Begin by installing the
saucectl CLI so it has access to your local project.
sudo sh -c 'curl -L https://saucelabs.github.io/saucectl/install | bash -s -- -b /usr/local/bin'
saucectl version 0.36.0 or later and XCUITest requires
saucectl version 0.44.0 or later.
2. Check out the demo repositories
Clone or download the Espresso and/or XCUITest example repos, as applicable to your project, to obtain the
saucectl directory structure and example files for use as templates.
3. Link your Sauce Labs account
- Generate a credentials file that
saucectlcan reference to authenticate your CLI commands.
- Enter your Sauce Labs
SAUCE_ACCESS_KEYat the prompts.
credentials.ymlfile in a
.saucefolder of your home directory.
You can set your Sauce Labs credentials as environment variables instead of generating a
credentials.yml, if you prefer. In systems where both sets of credentials exist, environment variable values are prioritized.
4. Configure your test parameters
Each demo repo includes a sample
config.yml file (in the
<root>/.sauce directory) that is preconfigured to run the example test, which is also included in the repo.
config.yml file according to the configuration documentation for Espresso and XCUITest.
You can create multiple configuration files to support different frameworks or different test setups and then reference the applicable configuration file at runtime using the CLI command:
saucectl run -c ./path/to/<configFile>.yml
5. Run your tests
run command to execute your tests using the parameters you have specified in your configuration file.
You can optionally set runtime parameters in the CLI, but keep in mind that
saucectl looks for settings in your config file first, so if you use the CLI flags to specify settings that are also set in your config file, the CLI flag values are ignored.