Like us on Facebook

LightBlog

September 8, 2015

Selenium Grid by using VisGrid

In this I will explain you what is selenium grid and how to setup this grid in simple way...

Selenium Grid:
Selenium-Grid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, Selenium-Grid support distributed test execution. It allows for running your tests in a distributed test execution environment

(From http://www.seleniumhq.org/docs/07_selenium_grid.jsp)


When to Use It:

Generally speaking, there’s two reasons why you might want to use Selenium-Grid.
  • To run your tests against multiple browsers, multiple versions of browser, and browsers running on different operating systems.
  • To reduce the time it takes for the test suite to complete a test pass.
(From http://www.seleniumhq.org/docs/07_selenium_grid.jsp)


Grid Set Up:

To set up grid its a bit tedious task..
1. Set up Hub
2 .Register your nodes to Hub
3. Mention max number of instances and sessions...etc etc...Everything you have to do it from command prompt...

Do we need to use boring command prompt..??
No
Do we have any GUI for grid?
Answer is Yes

What is the tool??

Here is Answer VisGrid

VisGrid: 
VisGrid is a GUI for Selenium Grid. You can start hub, create and attach a Selenium node very easily and quickly.



Here are details about VisGrid usage:


Steps to Download VisGrid:

Scroll down to bottom of page and Enter email id and click download.
You can see Release notes here -- http://www.codoid.com/products/downloadNotes/30




After downloading, unzip VisGrid.zip
Double click on Visgrid-1.8.jar
Click Start Hub Button
Now Hub is started and 'Create Node' & 'Stop Hub' buttons are displayed

Click 'Create Node' button
Select a browser and click 'Add' button

That's it. You have created Hub and attached a node successfully
Hit http://localhost:4444/grid/console to cross check your actions









By default VisGrid-1.8 came with 2.46, if you want you can change selenium-server and drivers.


Now your Grid is configured and ready to run scripts in parallel using Selenium Grid and VisGrid.

Steps to Create Grid_Maven Project:

Create a Maven Project --- Create-sample-maven-project
Difference between normal webdriver script and Grid script is how you instantiate your browser

What is Hub:
The hub is the central point where you load your tests into.
Controlling of execution will be done from Hub
The hub is launched only on a single machine
The machine containing the hub is where the tests will be run, but you will see the browser being automated on the node.

What is Node:
Nodes are the Selenium instances that will execute the tests that you loaded on the hub.
There can be one or more nodes in a grid.
Nodes can be launched on multiple machines with different platforms and browsers.
The machines running the nodes need not be the same platform as that of the hub.

Develop Script that can run on Grid:

There are two important classes which plays major role while running scripts using Grid
DesiredCapabilites is used to set the type of browser and OS that we will automate
RemoteWebDriver is used to set which node (or machine) that our test will run against.

Here is the sample script which can run script on Grid.






Here is sample testng.xml file



Final Project you can Download from here ...

Grid_Maven_VisGrid

11 comments:

  1. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  2. Thanks for article about Selenium Grid by using VisGrid. People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get selenium training in chennai

    ReplyDelete
  3. myTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance

    ReplyDelete
  4. You won't believe me, but I was planning to write a blog very similar to the one you have posted here. Great work!

    selenium training in navalur


    Python training In Navalur

    ReplyDelete