- The Platform Configurator
- Getting Started with Selenium for Automated Website Testing
- Getting Started with Appium for Mobile Native Application Testing
- Selenium Bootcamp by Dave Haeffner
- Appium Bootcamp by Dave Haeffner and Matthew Edwards
Sauce Labs is a cloud platform for executing automated and manual mobile and web tests. Sauce Labs supports running automated tests with Selenium WebDriver (for web applications) and Appium (for native and mobile web applications). This topic will provide you with basic information and code examples to get your Ruby tests up and running on Sauce.
The code in this topic is presented as an example only, since your tests and testing environments may require specialized scripting. This information should be taken only as an illustration of how you could set up your tests with Sauce Labs, and is not directly supported by Sauce.
It's very easy to get your existing Ruby tests up and running on Sauce.
To run an existing test on Sauce, all you need to change is your Once you have your tests set up to run in the Sauce cloud, you need to define the platform, browser, and version you want the test to run against, which is where You can manually enter the values you want for
driver definition, and make sure that the
sauce_endpoint variable includes your Sauce
caps come into play.
:version, or you can use the handy Platform Configurator to generate the
caps values for any combination of platform, browser, and browser version.
To run an existing test on Sauce, all you need to change is your
Once you have your tests set up to run in the Sauce cloud, you need to define the platform, browser, and version you want the test to run against, which is where
You can manually enter the values you want for
You can also clone this script directly from our GitHub repo.
Running Local Tests
Running Tests in Parallel
You can run your tests in parallel at two levels, and you can run your tests in parallel across multiple browsers. For example, if you have 10 tests and want to run on five browsers, this would be parallelism of five. You can also run tests across browsers and each test in parallel. Using our previous example this would be more like 50 parallel tests. Doing this requires that your tests are written in a way that they do not collide with one another, as described in our Best Practice topics avoiding external test dependencies and avoiding dependencies between tests.
Match Thread Count to Concurrency Limit
You should match your thread count to your concurrency limit, which is shown in the My Account section of your user profile information on the Sauce Labs dashboard.
For more information, check out the example scripts in our GitHub repo.
Reporting on Test Results
The Job ID is the simplest part of the process. The ID assigned to each job by Sauce Labs is the same as the Session ID for the corresponding Selenium session, which you can pull off the driver like so:
Using the REST API is best done with the sauce_whisk gem, which assumes you've set your Sauce username and access key as the
SAUCE_ACCESS_KEY environment variables.
This example shows how you would modify the example RSpec
spec_helper.rb file to check the status of the test, and pass that to the REST API.
That's it! Your tests will now be reporting their status to the Sauce Labs REST API.