Digital Solutions Blog

Dsg Subscribe Mail Web

Blogs (Digital Solutions Blog) (Digital Solutions Blog)

Testing Web Applications with Selenium Grid

Salma Naaz
8 Months Ago

Selenium has greatly evolved with time, especially since the 2.0 release when the legacy Selenium project merged with Google’s WebDriver. Nowadays, Selenium offers a wide range of programming languages supported to write the tests, an impressive browser compatibility list, the ability to record tests from user interactions and, above all in my opinion, the ability to re-execute tests across a grid of machines with various operating systems, browser families and versions.

Selenium Grid

Selenium Grid makes the Selenium testing more productive, Selenium Grid is a part of the Selenium Suite that specializes on running multiple tests across different browsers, operating systems, and machines in parallel.

Selenium Grid uses a hub-node concept where you only run the test on a single machine called a hub, but the execution will be done by different machines called nodes.

Grid is highly recommended to use because of its features like, Cross Browser compatibility testing.  It's easy and cost-effective way, that our web applications are usable in all sorts of operating systems and browsers.

Selenium-Grid is very flexible that tests can be combined to allow multiple instances of each browser type and version. A configuration such as this would provide both, parallel execution for fast test pass completion and support for multiple browser types and versions simultaneously.

Two Important Reasons to Use Selenium-Grid:

1) To run your tests against multiple browsers, multiple versions of browser, and browsers running on different operating systems.

2) To reduce the time it takes for the test suite to complete a test pass.

How to Setup Selenium-Grid

To run Selenium-Grid, users need to install java and download Selenium-Server jar file and set the path. And download various browsers drivers into the machines.

Launching Hub

Start with the path where the server standalone file is saved.

java -jar selenium-server-standalone-2.39.0.jar -role hub -port 4441

Registering Node

In Another Machine(Node), start with the path where the server standalone file and browser drivers are saved.

 java -jar selenium-server-standalone-2.39.0.jar -role webdriver -hub http://xx.xx.xx.52:4441/grid/register -port 4444

To verify whether the hub is running, go to http://xx.xx.xx.52:4441/grid/console

 

Once this is done, the test scripts can be run in the Hub and it will be executed in the nodes.

Benefits of Using Selenium

Selenium, through WebDriver and Grid components, provides a powerful mechanism to automate browser tests. Tests can be easily distributed across a grid allowing multi-browser, multi-OS testing. Tests can be easily created and executed within our favorite IDEs and added to a Continuous Integration process, including code coverage metrics for Selenium tests.

Selenium helps to achieve important productivity improvements. The time invested in writing an automated test is rapidly returned by the fact that no effort is needed to re-execute them. Moreover, being automated, it is likely that they will be execute more often that if they were manual, contributing to increase the quality and predictability of our software releases.

Form

Talk To Our Experts