28 Feb 2018

Sauce Labs – Test automation in the cloud using selenium

9:50 PM Selenium, Testing, TestNG 0 Comment

Cloud Testing with SauceLabs:

We can set up Selenium Server on our local computer or we can use cloud grid system providers such asSauceLabs, Browserstack or TestingBot, etc. This kind of companies provides extensive grid on their servers. You can find all OS and all browser versions. In this post will see how to test with those services.

What is Sauce Labs?
SauceLabs is a grid in the cloud. We can run our tests on their cloud with different browsers and operating systems. You can also do manual testing. In order to do these, first, we should go saucelabs.com and register for free.

In the saucelabs dashboard: Automated Builds, Automated Tests, Manual Tests.

Let’s start how to Run a Selenium Tests with SauceLabs:

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:
1. First, we should go saucelabs.com and register for free.

1. Create a Maven project and add selenium-related things (version, TestNG) in the pom.xml

In the above SampleSauceTest, We are providing “USER_NAME” and “ACCESS_KEY” to connect saucelabs.

How to get Access Key?

Sauce Labs accounts are protected by a username, a password, and an access key. We use our username and password to access Sauce Labs’ site, and we use our username and access key to allow our tests to access SuaceLabs’s Selenium servers

1. Go to User Settings
2. ACCESS_KEY – Copy and Paste it into the class.

We configure Remote WebDriver with DesiredCapabilities (it configures browser type, version, platform, etc.) and external server URL. Then, we can run our tests on the server which we configured for RemoteWebDriver.

NOTE: Run Script and Verify on Saucelabs

Overview of Sauce Labs Features:
1. Web Functional testing
2. Cross Browser testing
3. Mobile Web testing
4. Manual Testing
5. Automated Testing Platform
6. Real device coverage

Benefits of SauceLabs:
1. Running tests 24/7
2. Fewer human resources
3. Simultaneity
4. Record
5. Screenshots

Thanks for reading this article!

Leave a Reply