When Should I use Selenium Grid?


Introduction

  • Among the four flavors of Selenium, Selenium Grid is one such flavor. The facility to run multiple tests on multiple machines, on multiple browsers simultaneously is made possible by Selenium Grid. It also allows running test cases on multiple browsers in parallel.

  • Selenium Grid has 2 versions- older Grid 1 and older Grid 2. Old Grid 1 is obsolete now, hence Grid 2 is used.

  • Selenium 2 is bundled with Selenium Server jar file. There is no need to install Apache Ant unlike Grid 1.

How it works

  • Selenium Grid consists of hub and multiple nodes. Test runs on single machine called Hub and the execution will be done on various machines (may be virtual machines) called nodes.

  • Hub (Single machine) receives the test to be run along with the information such as the browser, its version, platform on which the test should be executed.

  • Nodes (Other Machines) are registered to the hub. According to the configuration of the nodes, hub selects the available node that has the requested browser, version, and platform. But if the Hub doesn't find the node with any such configuration, it returns the error.

  • When the node is selected Selenium commands initiated by the test are sent to the hub, which passes them to the node assigned to that test.

  • The node then runs the browser and executes the Selenium commands within that browser against the application under test.

Uses of Selenium Grid:

  • When it is required to proceed with the distributed test execution Selenium Grid is used. It runs test cases on different version of browsers on different OS simultaneously.

  • When we have a huge stack of test cases and limited timelines, we can multiple test cases simultaneously ensuring speedy execution. If we have Selenium enabled machines in 5 such machines and we have 100 test cases the execution time is reduced by 5 times. Hence it increases the batch processing time.

  • By executing on different versions of browsers and OS, it also ensures the compatibility of test case with wide number of browsers and OS.



raja
Published on 09-Oct-2019 12:08:42
Advertisements