How to Run a Selenium Test in SauceLabs

Automation Testing Published on:

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 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!

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

How to Create a Test Automation Framework

Posted on 04/03/2023

Test automation is an essential part of modern software development. This helps improve ...

Playwright Tutorial: Getting Started With Playwright Framework

Posted on 04/03/2023

Web automation testing is an essential part of modern software development. It helps ...

Top API Testing Tools for 2023

Posted on 03/23/2023

List of the best API testing tools free and open source for 2023. ...