Using the saucectl CLI
The saucectl command line interface orchestrates the relationship between your tests in your framework, and the rich parallelization, test history filtering, and analytics of Sauce Labs. saucectl performs the underlying business logic to access the tests in your existing framework, runs them in the Sauce Labs Cloud, then securely transmits the test assets to the Sauce Labs platform, where you can review, share, and evaluate your test outcomes at scale.
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
- Know which test framework and browser versions you plan to run tests against
System Requirements
Supported OS:
- Windows 10 / Windows 11
- macOS 10.15+
- Linux
Supported Frameworks and Browsers
Below are the frameworks supported.
- Cypress
- Playwright
- Cucumber.js-Playwright
- TestCafe
- Replay
- Espresso
- XCUITest
| Supported Platforms |
|---|
| Android 5.1+ |
| Supported Platforms |
|---|
| iOS 10+ |
Installing saucectl
saucectl binaries are attached to GitHub releases.
Following is a list of saucectl installation options that are common across different development environments.
- NPM
- NPM + Binary
- Homebrew
- cURL
- Windows Powershell
npm install -g saucectl
SAUCECTL_INSTALL_BINARY=https://company.domain.com/saucectl_0.32.2_mac_64-bit.tar.gz npm install -g saucectl
Use the SAUCECTL_INSTALL_BINARY environment variable to make saucectl available from a known source in your control or if you use npx saucectl to bypass installation.
brew tap saucelabs/saucectl
brew install saucectl
sudo sh -c 'curl -L https://saucelabs.github.io/saucectl/install | bash -s -- -b /usr/local/bin'
curl -fsSL -o get_saucectl.sh https://saucelabs.github.io/saucectl/install && \
chmod 700 get_saucectl.sh && \
sudo ./get_saucectl.sh -b /usr/local/bin
$url = Invoke-RestMethod -Uri https://api.github.com/repos/saucelabs/saucectl/releases/latest | ForEach-Object {$_.assets} | Where-Object { $_.name -Like "*_win_64-bit.zip" }
Invoke-RestMethod -Uri $url.browser_download_url -OutFile saucectl.zip
Expand-Archive -Force -Path ./saucectl.zip
Move-Item -Path ./saucectl/saucectl.exe -Destination saucectl.exe
Remove-Item -Force -Recurse -Path ./saucectl,./saucectl.zip
Mingw on Windows is known to interfere with the interactive saucectl commands, so Windows users should use cmd or powershell when interacting with saucectl.
Updating saucectl
To ensure you have access to the most current feature set of saucectl, keep your installation up to date by periodically upgrading to the latest release.
To do this, run the same command you used to download saucectl. If you originally installed saucectl using npm, for example, you'd run npm update -g saucectl.
Next Steps
Once you've got saucectl installed, you can customize your configurations based on your testing objectives. The following sections offer some common use cases.
Associate Your Credentials
Your SAUCE_USERNAME and SAUCE_ACCESS_KEY (available on your User Settings page) are required to run tests through saucectl. You can pass your credentials to saucectl via several different methods:
- Use the
saucectl configureCLI command to create acredentials.ymlfile from whichsaucectlcan automatically pull your credentials. - Set your credentials as environment variables that
saucectlcan access at runtime.
If you set your credentials using more than one of the methods above, saucectl will apply the values in the following order of preference:
- Environment Variables
credentials.ymlfile
Check Out Your Framework Demo Repo
saucectl provides working samples for each of its supported frameworks, so you can quickly run a sample test, or use the project as a template for your own tests.
- Cypress Demo
- Playwright Demo
- Cucumber.js with Playwright Demo
- TestCafe Demo
- Replay Demo
- Espresso Demo
- XCUITest Demo