Prerequisites

Instant Test

Download this script from the GitHub repo to your local machine, provide the information for SAUCE_USERNAME and SAUCE_ACCESS_CODE as indicated in the script, and then save and run the script. If you log in to saucelabs.com before you run the script, you'll be able to watch the script's progress as it executes.

Clone from: https://github.com/saucelabs-training/demo-js/blob/master/web-tests/instant-sauce-mocha-test1.js

To find your Sauce Labs access key:

  1. Sign in to https://saucelabs.com with the username you set up when you created your account. 
    You will use this same username in your test script. 
  2. To find your access key:
    1. Click your name in the Account Profile menu in the upper-right corner.
    2. Click User Settings.
    3. Scroll down to Access Key and click Show.
    4. Enter the password you use to sign in to Sauce Labs to view the access key.
    5. Click the Copy icon.

Instant Test with Environment Variables

This example script follows the best practice of using environment variables in place of hardcoded authentication credentials. Once you've been able to successfully run the instant test with hardcoded credentials, you can use this test to make sure that you've correctly set up your environment variables for authentication.

Clone from: https://github.com/saucelabs-training/demo-js/blob/master/web-tests/instant-sauce-mocha-test2.js

Instant Test with Best Practices and Sauce Labs Reporting

This example script illustrates the use of several best practices in test design, and will report Pass/Fail status to the Sauce Labs dashboard.

Clone from: https://github.com/saucelabs-training/demo-js/blob/master/web-tests/instant-sauce-mocha-test4.js

Running Local Tests

Running Tests in Parallel

For more information, check out the example scripts in our GitHub repo.