The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

Welcome to Sauce Labs! Sauce Labs enables Dev and QA teams to perform UI testing early, often, and throughout their development cycle across multiple operating systems, browsers, and devices including web, hybrid, and mobile applications. Our platform includes a variety of tools including live and automated testing on real and virtual devices, front-end performance testing, and a variety of tools for evaluating test results. 

Sauce Labs is a powerful tool for automation because you can run hundreds of tests on hundreds of devices at the same time, while gathering information and insights into the functionality of your application, along with screenshots and detailed data about passing and failing tests. Sauce Labs also makes it easy to do continuous testing as part of your release pipeline. 

While we support a number of different automation tools, this document is focused on running Selenium tests because: 

  • Selenium is the most widely used test automation tool 
  • Sauce Labs was built from the ground up by Selenium co-founders, making us the leaders in the space

NOTE: Expect similar documentation for other automation tools in the future!

Your options for getting started with Selenium on Sauce Labs depend on your experience level. For more information, see the following sections: 

New to Automated Testing 

Check out Sauce Labs Demonstration Scripts for information on writing Selenium tests to communicate with our virtual machines and send results to Sauce Labs.

Already Have a Suite of Tests

If you have created Selenium tests you want to execute on the Sauce Cloud, you might only be a few steps away. 

What You'll Need

  • A strong background in Selenium and RemoteWebDriver, along with the following:
    • Significant experience with your test framework
    • Experience with ether C#, Java, JavaScript, Python, or Ruby
    • Tests that were already running on a different cloud provider or an internal grid

NOTE: If you don't meet these requirements, go to Learn Automation to get started. You can also go to detailed examples that cover a variety of use cases and languages in http://github.com/saucelabs-training/ 

  • Your Sauce Labs User Name and Access Key
  • The data center endpoint you’re using. The DC for free-trial users is based on the region you selected when you signed up.
  • Verify that your tests are set to pass or fail. This setting is essential for getting actionable information from them. For more information, see Setting Test Status to Pass or Fail.
  • If you’re testing on your network, you might need a Sauce Connect Proxy tunnel. To learn how to create a tunnel, see Getting Started with Sauce Connect Proxy.

IMPORTANT:

What You'll Do

1) Create an account on Sauce Labs. 

2) Add line 3 below to your tests in all the language bindings, where:

driver = new RemoteWebDriver(new Uri($"https://{<SAUCE_USERNAME>}:{<SAUCE_ACCESS_KEY>}@{<SAUCE_DC>}"), capabilities);
driver = new WebDriver(new URL("https://" + <SAUCE_USERNAME> + ":" + <SAUCE_ACCESS_KEY> + <SAUCE_DC>));
Nightwatch.js
username: <SAUCE_USERNAME>,
access_key: <SAUCE_ACCESS_KEY>,
selenium_host: <SAUCE_DC>
Protractor.js
sauceUser: <SAUCE_USERNAME>,
sauceKey: <SAUCE_ACCESS_KEY>,
sauceRegion: <SAUCE_DC>
WebdriverIO.js
user: <SAUCE_USERNAME>,
key: <SAUCE_ACCESS_KEY>,
region: <SAUCE_DC>
driver = webdriver.Remote('https://{}:{}@{}'.format(<SAUCE_USERNAME>, <SAUCE_ACCESS_KEY>, <SAUCE_DC>))
@driver = Selenium::WebDriver.for(:remote, url: "https://#{<SAUCE_USERNAME>}:#{<SAUCE_ACCESS_KEY>}@#{<SAUCE_DC>}", desired_capabilities: capabilities)

3) Run your tests.

Video: Pointing Automated Tests to Sauce Labs

This video shows you how to update your current automated tests to run in the Sauce Labs Continuous Testing Cloud.

More Information