How to Run a Selenium Test in SauceLabs

How to Run a Selenium Test in SauceLabs

In this video, I’m going to show you how easy it is to get started using Sauce Labs and to run your first Selenium test on Sauce.

For those of you that don’t know, SauceLabs is the exclusive sponsor of my TestTalks podcast. Accordingly, I have a special code that you can use to get 20 hours of free automation! Check out my SauceLabs page for more info.

SauceLabs is great because they allow you to focus on testing instead of worrying about maintaining a bunch of environments against which your tests need to run. To get a small taste of this sauceomeness, let’s take a look at what it takes to get a Selenium script running in the SauceLabs Cloud.

Getting Started with Sauce Labs

First, log on to SauceLabs with your free account. (Check out my video on how to use my special SauceLabs promo offer.)

Under the Tools section, select the Getting Started button.

You’ll be presented with three options:

  • Automated
  • Mobile
  • Manual

Select Automated


Now all you need to do is follow this quick, four-step process:


  • Choose your language.

For this example I’ll be using Java, but SauceLabs supports all the Selenium language bindings.

  • Next, set up your Project.

The easiest way to get up and running is to use the sample SauceLabs project, then modify it to get your tests started. I’m using Maven and JUnit, so I’m going to copy the JUnit Maven option to create my sample project.


  • Open up a command line, paste the above code and hit Enter.


  • Maven should automatically create the SauceLabs sample project for you.


  • Next, open up your IDE and import the SauceLabs sample project.
  • Once the project is imported, open up the SampleSauceTest.java file. It contains everything you need to get started. Sauce also did a great job of documenting each line of code to help you understand how everything works.
  • For this example, I’m going to delete their Amazon test and add two of my own tests that will run against my Selenium sample test page.


  • Once you’ve modified, it’s time to run. From your IDE, select the Maven run command.
  • Once the tests are done running, log on to SauceLabs to view the results.

What’s really cool is that once your test is done running you’ll have a bunch of option like screenshots, video and logs to help you check your results.


Why Sauce Labs is Awesome

When you run your test in Sauce, there’s no setup on your part, and you won’t have to waste time digging through never-ending log files. When your tests are done you’ll get your results automatically — along with video and screenshots — so you’ll know exactly what to fix if your test fails!

You can also run your tests against over 485 different combinations. Think about how much time this will save you. I work for a large company and I would normally have to request a new VM for each different configuration. Next, I would have to install and maintain all these environments. Then I’d have to go to our Continuous Integration group and pray that they would have the time to set the test up to run.

With SauceLabs, I can bypass all that and focus on what I love to do — creating automated tests.

Checkout Sauce Labs yourself by using my promo code testtalks14 and get 20 hours of automated testing for free!

5comments
QTP Tutorial - April 6, 2015

Thanks for that Joe. Have you ever used BrowserStack? I find that it’s kind of unstable and they have a lot of issues on their end. Do you have the same issue with Sauce Labs?

Reply
    Joe Colantonio - April 7, 2015

    Hi – no I have not used BrowserStack before. What kind of un-stability have you seen or heard about with BrowserStack?

    Reply
How to run a .NET C# Test in Sauce Labs - Joe Colantonio - Succeeding with Test Automation Awesomeness. I’ll show you how! - May 13, 2015

[…] have gone through your video on How to run a Selenium Web driver test case with Sauce Labs but it was for Java. Can you please show [us] how to do the same using the Selenium C# .NET […]

Reply
Sauce Labs C# - May 13, 2015

[…] have gone through your video on How to run a Selenium Web driver test case with Sauce Labs but it was for Java. Can you please show [us] how to do the same using the Selenium C# .NET […]

Reply
Click here to add a comment

Leave a comment: