- 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
There are two types of automated website tests you can run on Sauce Labs:
- Testing websites with common desktop browsers such as Safari, Firefox, and Internet Explorer, with operating systems such as OS X and Windows
- Testing websites with the native browsers on mobile devices such as an iPhone or Android phone
The overall process for running these two types of tests is the same, except for desktop browser tests you use Selenium scripts, and for the mobile native browser tests you use Appium. When you use the Platform Configurator to set the desired capabilities of your test in Step 2 of Setting Up Your Test, described below, your selection of either Selenium or Appium will provide you with the options for setting up the type of test you want to run.
IP Ranges and Data Center Endpoints
Sauce Labs has data centers in both the US and EU. You can access Sauce Labs services from either location by providing the appropriate URL endpoints, and whitelisting their associated IP ranges.
Virtual Device Cloud: https://ondemand.eu-central-1.saucelabs.com/wd/hub
Sauce Connect Proxy: https://eu-central-1.saucelabs.com/rest
REST API: https://eu-central-1.saucelabs.com/rest/v1
184.108.40.206/21 (this is equivalent to the range
220.127.116.11 – 18.104.22.168)
22.214.171.124/21 (this is equivalent to the range
126.96.36.199 - 188.8.131.52)
Before Running Your Test
- You need to have set up a a Sauce Labs account
- You should have an existing Selenium or Appium test that you want to run on Sauce. If you've never written a Selenium test script you should read the topic Getting Started with Selenium for Automated Website Testing. If you don't have an existing script, you can clone and run one of the example scripts from our Sauce Labs Sample Scripts repo in GitHub, but be advised that these are provided as examples only and should not be modified for use in production.
- The website you want to test must be accessible over the Internet for our browsers to be able to reach it. If it's behind a firewall or on localhost, you need to set up a secure Sauce Connect tunnel for us to connect to it.
- Sauce Labs uses the IP ranges
184.108.40.206/21 and 220.127.116.11/21for communication with our browser cloud. Make sure you have whitelisted these ranges as necessary.
Setting Up Your Test
- Set up your test to connect to the Sauce Labs browser cloud using your account credentials.
Use the Platform Configurator to specify the Desired Capabilities of your test.
Desired Capabilities are the mechanism in Selenium and Appium that lets you specify the combination of platform, operating system, and browser that you want to use in your website tests. You can find out more about using Desired Capabilities in the topics under Test Configuration and Annotation, as well as in the Selenium and Appium documentation. You can also check out some Examples of Test Configuration Options for Website Tests.
Selecting Desired Capabilities for Desktop Browser Tests
To run a test using a desktop browser, select Selenium, and then select the platform, operating system, and browser you want to use in your test.
Selecting Desired Capabilities for Mobile Native Browser Tests
To run a test against a mobile native browser, select Appium, select the mobile device you want to test with, and then select Web Testing.
- Make sure your test is set up to report results to your Sauce Labs dashboard.
On its own, Selenium only knows if a test has completed or not. If you want more information, like whether the website passed or failed the test, you need to set up reporting to the Sauce Labs dashboard. As with the case of setting up your authentication credentials, the exact reporting configuration depends on the language you're using in your test script. The scripts in Example Appium Scripts for Mobile Application Tests and Example Selenium Scripts for Automated Website Tests include examples of how to enable reporting for each language. You can also use the Sauce Labs REST API to annotate your tests after they have completed, including pass/fail status.
Running Your Test
- Log in to the Sauce Labs web interface.
You don't need to be logged in to run your test, but if you are you can watch your test run and the results appear in the dashboard.
- On your local machine, run your test script.
That's it! As your test script executes you'll see the results appear in your dashboard.
After Running Your Test
Now that you've run your first test with Sauce, you're ready to explore more advanced functionality!
- You can run multiple tests in parallel to accelerate your development pipeline
- You can integrate your tests on Sauce Labs with Jenkins, Bamboo, and other continuous integration/continuous delivery servers
- You can add more team members to your account so they can run tests with Sauce too