A Job for Life

One of the most drastic changes in my life was the moment the pregnancy test gave me a positive result: I was pregnant. One of the most drastic changes in my life was the moment the pregnancy test…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Remote Test Execution with Selenium and Sauce Labs

Remote test execution speeds up the testing process and ensures consistent coverage and maintenance of your tests. Sauce Labs is one of the solutions that stands out when it comes to the execution of Selenium scripts in remotely placed endpoints.

Remote test execution means using remote machines to run tests simultaneously and execute them across different test environments, i.e. different operating systems, browsers, system configurations, etc.

In contrast to running tests on a local machine, remote test execution — as its name suggests — requires a remote execution environment.
The principal advantage of this approach is the ability to perform execution of test automation on multiple remote machines as well as multiple browsers at the same time. This is particularly useful in a distributed environment when you have to execute hundreds or even thousands of tests on a regular basis.
Executing tests on multiple machines and browsers doesn’t only save time but ensures better coverage as well.

Running tests on local machines, however, shouldn’t be completely tossed out because of all of the advantages of remote test execution. Some types of tests benefit more from being run on a local machine, allowing testers to have a look at the SUT and debug tests at the time of testing, rather than having to guess what went wrong based on screenshots or videos. Also, some testers don’t have projects big enough to justify the need for the remote test execution on multiple machines. However, if the scope of a project expands, executing all test cases using one system could become more difficult.
For example, what would happen if you need to check things on multiple browser and OS combinations?
This is where remote test execution comes into play. Rather than set up a costly test infrastructure that you need to run and maintain on your own, you can easily outsource things to someone else’s grid, preferably to one located in the cloud.

One of the most popular tools/solutions among developers and testers who need to execute multiple tests across different browsers and operating systems is Sauce Labs.

There are various reasons why testers choose Sauce Labs for manual and automated testing:

Note: You may need to enter your Sauce Labs password to view the access key

Finally, click the Copy icon.

You’ll find both username and access key in your code, looking like this:

You’ll need to replace these with your actual credentials.

Next, you should have a Selenium environment with the Java bindings set up on a local machine where you’re running your tests. From now on, the integration is quite simple, as the only piece of code you have to update is the one allowing you to fetch the Selenium driver.

Here’s what it would look like in Java:

You’ve probably noticed that this piece of code invokes no browser. For someone who is accustomed to using WebDriver driver = new FirefoxDriver(); command in order to invoke a browser in Selenium, this may be a surprise.
In Sauce Labs, we call the RemoteWebDriver class to connect a remote driver pointed at ondemand.saucelabs.com specifying your Sauce Labs account credentials and desired browser configuration.

Here’s an example of how the Selenium Java test would look like when integrated with Sauce Labs:

As you may see, integrating SauceLabs into your current testing process is pretty straightforward. Sauce Labs is simply used as a remote driver for Selenium, which does not have much impact on the way you currently automate your tests.

While using Sauce Labs simplifies the test execution, it still requires developers and testers to set up some things manually, such as adding your authentication credentials, specifying the path to the Sauce Labs cloud, configuring the desired capabilities for your test, enabling reporting to your Sauce Labs dashboard, etc. This can be a hassle if you need to execute multiple endpoints in a short timeframe.

Pointing to the Sauce Labs cloud infrastructure will invoke the browser remotely, however, the remaining execution and result workflows remain the same. You’ll continue to manage the test execution from within Ranorex Webtestit.

To add Sauce Labs as a remote endpoint in Ranorex Webtestit, first, choose the ‘Remote endpoint’ tab. Sauce Labs is selected by default.

Your Sauce Labs credentials (username and access key) will be inserted in the test code automatically, allowing you to remotely execute your tests from Ranorex Webtestit in an instant.

After this, simply run your test cases in Ranorex Webtestit. Simultaneously, your tests will run in your Sauce Labs dashboard.

When the test is over, you’ll be able to view a regular report in Ranorex Webtestit.

You will also be able to view a Sauce Labs report that will provide a video showing all the actions performed in the test, as well as other important details, including commands, view logs, and metadata.

Using a third-party cloud provider such as Sauce Labs is probably the most convenient way to coordinate your tests across multiple browser, operating system, and device combinations, and ensure better test coverage and maintenance. With Ranorex Webtestit you can speed up this process, even more, thanks to seamless integration with Sauce Labs cloud.

Add a comment

Related posts:

The Division and Collapse of America

America was founded on a set of beliefs and principles, with personal freedoms taking centre stage. Evolving from a pull-yourself-up-by-the-bootstraps philosophy, the belief that anyone can forge…

Love Letter

I have never written a love letter to you before, and that fact (jumping out on paper before my eyes) startles me because I have loved you for a long time. It makes me ashamed to realize now that…

Come Back Hobbies

I am a boomer and I can knit, do crochet, macramé, and some decent tatting too. Oh, I forgot the cross stitch and lazy daisy work on matty cloth and casement material. And remember the French knots…