What is Selenium Grid ?

Introduction

In this post, we will understand the concepts of Selenium Grid. We can use the Selenium grid for distributed testing. A distributed test distributes tests across multiple physical and/or VM’s so that tests can run in parallel. Distribution of tests cuts down the time required for running tests. Also, with Selenium Grid, we can leverage our existing computing test lab infrastructure. Furthermore, it allows us to easily run multiple tests in parallel, on multiple nodes, in a heterogeneous environment where we can have a mixture of OS and Browser support.

Architecture Diagram

Below is an example architecture diagram having capabilities to run tests on Linux, Windows, Mac platforms. A hub distributes the test across the nodes as shown in the below diagram.

SeleniumGridArchitecture

 

As shown in the figure selenium grid allows us to run multiple instances of WebDriver in parallel and different OS’es. All the tests can run in parallel on multiple browsers running on different OS. It could be Safari on Mac or Firefox on the Linux machine. It makes all these nodes appear as a single instance, so tests do not have to worry about the actual infrastructure. Selenium Grid cuts down on the time required to run Selenium tests.

Selenium Grid =  A Hub + Multiple Nodes

Hub

Hub is a server that distributes all tests requests to different nodes. Furthermore, Hub is the central point, which will receive the entire test request and distributes them among the nodes.

Node

Nodes receive the requests to execute from the Hub. Nodes make parallel testing possible, multiple tests can be executed at the same time on different nodes.

Benefits

  • Reduces a lot of test execution time.
  • Makes automation of cross-browser testing possible.
  • Makes automation testing on multiple OS possible.

In conclusion, by using Grid we can test web applications on a variety of browser and OS combinations. Also, if the tests grow enormously in number, we can cut down test execution time by running them parallel. Furthermore, by adopting Cloud-based Testing techniques we can reduce costs and increase the efficiency of tests.