Selenium Grid is a part of the selenium suite that specialises in running many tests across different browsers, operating systems and machines in parallel. This will be achieved by routing the commands of remote browser instances where a server acts as a hub. A user needs to configure the remote server acts as a hub a user has to configure in order to execute the tests.
Selenium Grid uses a concept of hub node where only run the test on a single machine called hub, but the execution will be done on different machines called nodes.
When to use selenium Grid?
Generally, there are two reasons to use the Grid
- To run the tests against the multiple browsers, multiple versions of the browsers and also browsers running on the various operating systems.
- To reduce the time it takes for test suite to finish the test pass.
Grid is used to complete the execution of the test pass quickly by using the multiple machines to run the tests in parallel. For large and long running test suites for performing large amount of data validation, this will be a important time saver by shortening the turnaround time we can boost the time spent on running the test suite.
Grid is used to support running tests against the multiple runtime environments especially against different browsers in the same time. Consider an example, grid of virtual machines can be setup with each supporting a different browser that the application which is be tested should support.one can have a grid all of the same browser, type and version. Grid is flexible. The main functionalities are:
- It has central entry point for all tests.
- Management and control of the nodes where browser may run
- Running parallel tests
- Cross platform testing
- Load balancing
Selenium grid has to be used when we Run our tests against different browsers, operating systems and machines, all these at a same time. This ensures that the application you are testing is fully compatible with a wide range of browser OS combinations. Save time in the execution of your test suites, if Selenium Grid to run 4 tests at a time then we will finish the whole suite around 4 times faster.
Selenium Grid Architecture:
Selenium Grid has a hub and node Architecture
The hub is central point where you load your tests into. There will be only one Hub in a grid. The hub is launched only on a single machine such as computer who’s OS is windows 7 and browser is IE. The machine containing the hub is the place where the tests are run, but the browser being automated on the node is seen.
Nodes are Selenium instances which will execute the tests which are loaded in the hub. Nodes can be one or more in a grid. Nodes are often launched on multiple machines with different platforms and browsers. The machines running on the nodes need not be in the same platform as of the hub.