Using Hudson as Selenium Grid for Continuous Integration

by rutvik on February 28, 2010

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 @infostretch

VN:F [1.8.1_1037]
Rating: 8.6/10 (7 votes cast)
Using Hudson as Selenium Grid for Continuous Integration8.6107

{ 1 trackback }

How do I integrate my Selenium RC tests integrate with Hudson
July 7, 2010 at 4:22 pm

{ 2 comments… read them below or add one }

Sara June 7, 2010 at 9:11 am

The release notes for the Selenium Plug-in for Hudson by Kawaguchi at http://weblogs.java.net/blog/2009/05/16/hudson-selenium-grid-plugin mention that “Once you install this plugin from the update center, Hudson master will become the Selenium Grid hub, the center of the Selenium Grid system. [...] each slave that you have in your cluster will now run Selenium RCs. The whole process happens completely automatically, without any additional configuration.”

However, I’m having trouble having the RCs launch so autimatically when using even the demo. I have to launch them on each of the slaves, one by one. Is there any documentation on this anywhere? There are quite a few people that can’t seem to do this and posting questions about it online in various userGroups, just no solutions.

rutvik June 8, 2010 at 5:25 pm

The complete setup does require some tweaks.There is no configuration required.However since there are multiple moving parts,tweaks are required.If you explain me what is the usecase you are trying to achieve,I might be able to help you out.

Leave a Comment

Previous post:

Next post: