In my last post about Hudson integration with Selenium RC,I talked about how to use Hudson to drive your Selenium RC tests.This configuration would work fine in most scenarios.However this is not a optimized configuration if you want to take advantage of executing your tests in parallel.For e.g if you have two machines in your lab with FF 35,you might want to run RC tests on both machines at same time.
Selenium Grid offers this capabilities.Below I will discuss how to take advantage of this in a continuous integration process.
I strongly recommend that you try to setup Selenium Grid on your local machine first if you had no prior experience with Selenium Grid.There are some very good Selenium Grid demos available here
Step 1
Download and Install Selenium Grid plugin for Hudson.You should see a small icon on your Hudson home page.Clicking on which you would see the RC’s registered to this Selenium Grid
Step 2
Important before this step,make sure that you are able to ping the RC server from Hudson and viceversa.If they cannot see each other it will not work
Registering your RC to Selenium Grid.This took me quite a while to figure out,but the trick is in the way you register this RC.
ant -Denvironment=”/qalab_01/windowsxp_1/:*firefox” -Dport=5555 -Dhost=10.63.87.192 -DhubURL=http://myhudson.com:4444 launch-remote-control
Let’s go through the parameters one by one,you should be familiar with the parameters if you did a local setup of Selenium Grid.
environment=Machine Name/Label Name:browerCommand (Look at my earlier post about Selenium Hudson Integration to understand how to setup machine names and label names)
port=Available port on the machine where you are launching RC
host=IP address of your RC machine
hubURL=location of your Hudson server (which also doubles up as Selenium Grid now)
Step 3
Repeat similar process for another RC and when you click on the Selenium icon on your Hudson page,you should see that there are two RC’s registered to this Selenium Grid.
Step 4
Configure your Hudson job to run on master(i.e Selenium Grid) and it will take care of assigning the jobs to correct RC
Some important resources that helped me during the setup are
Amit Easow’s post on Hudson integration
Unregistering the Selenium RC command by this Selenium Blog.The command is lifesaver and I am repeating a example here
http://localhost:4444/registration-manager/unregister?host=locahost&port=5556&environment=*iexplore
To give a recap,I used ANT,TestNG,Selenium Grid,Hudson to accomplish this.
One last thing,The Selenium server jar is part of the Selenium Grid plugin bundle.You might want to replace it with a version of Selenium server you like on the Hudson server.
Follow us on @apexon