In the previous post, we have learnt about TestNG Listeners. In this post, we will understand important concept of Selenium which is Selenium Grid.
Till now , we have seen that Selenium Webdriver executes the test cases in single machine. But Selenium grid can be used for parallel testing that means you can run a set of test cases on different machines.
What is Selenium Grid?
Selenium Grid is nothing but a formation of hub and its multiple nodes where one node can act as a machine containing any particular operating system like Mac, Windows etc running test case on a specified browser.
Hub: A Hub can be considered as a server which distribute all test cases requests to different nodes. It is center point Selenium Grid Architecture Where you will load all your test cases. There is only one Hub which need to be started before executing the test cases.
Node: There can be multiple nodes started by the Hub. Node will receive the request from Hub to execute the assigned test to it. A node can contain a particular Operating system and selenium supported browser to execute the test script. A node does not need to have the same operating system as contained by Hub.
There are 2 version of Selenium Grid i.e. Grid 1.0 and Grid 2.0. Selenium Grid 1.0 was the earlier version. Selenium Grid 2.0 is the latest version which support both Selenium RC and Selenium Webdriver Scripts.
By using Selenium Grid
- Parallel testing is possible that means multiple test cases can be executed at a time.
- test cases can be executed on different operating systems simultaneously.
- test cases can be run on different browser like chrome, mozilla etc. to check the browser compatibility.
- test cases can be run on different version of the same browser.
Benefits of Selenium Grid:
- Reduces a lot of batch execution time.
- Perform cross browser testing.
- Perform multiple OS testing.
- When a node is free , it automatically picks up the test case waiting in the execution queue.
In the next post, we will installation of Selenium Grid and configuration of Hub and nodes.