Home > Hudson, Selenium > How to configure selenium scripts through Hudson.

How to configure selenium scripts through Hudson.

Through this post, I am trying to explain  ‘How to configure Selenium tests in Hudson’. We all know about Selenium and Hudson, these are two well know open source tools. And Hudson is very much helpful for building the selenium scripts in a scheduled manner hence Selenium will take more time to execute tests if suite contains more tests.

Before moving to configuration part we need to create a build.xml file for building the selenium scripts using Ant build. Because I am going to use Ant process to Invoke build.

Preconditions :

Selenium test cases should be able to run through Ant build.

Hudson Setup:

First of all, we need to install Hudson in our system. Its a straight forward and easy step. You can find that in http://wiki.hudson-ci.org/display/HUDSON/Installing+Hudson. After the installation hudson should be up in http://localhost:8080.

Configure the Hudson Jobs for building Selenium scripts:

Now we need to configure selenium Junit test cases in Hudson, for that follow below steps.

1. Click on ‘New Job’ link in the side panel.

2. Enter Job name[say DemoProject]

3. Select ‘Build a free-style software project’ and click on OK button. 

4. You can configure your build in different ways.

  • Build the code from your machine
  • From any of the Source Code Management’ system like CVS, SVN, GIT etc

5. Steps to build test cases from your local machine

5.1 Click on Advanced button under ‘Advanced Project Options’

5.2 Check ‘Use custom workspace’ check box.

5.3 Enter you path where test cases located.

6. Steps to build test cases from any of the ‘Source Code Management’ system like CVS, SVN, GIT [In this step, we don’t want use ‘custom workspace’ as explained above]

6.1 Select any of the system under Source Code Management’ system [say Subversion]

6.2 Enter ‘Repository URL’

6.3 Keep ‘Local module directory’ as .

7. We can configure build time also in Hudson using ‘Build Triggers‘. Currently following build triggers are available

  • Build after other projects are built
  • Poll SCM
  • Build Periodically[generally used one and using syntax of cron]

8. Now, we need to tell Hudson about how do we need to Build the test cases. For that we can use any methods in ‘Add Build Steps’ under ‘Build’ section. We can use either of

  • Execute Windows batch command
  • Invoke Ant
  • Execute Shell
  • Invoke top-level Maven targets.

9. Here I am going to use ‘Invoke Ant’  option and select it from the list.

10. Specify the target name in the ‘Targets’ field.

11. So you finished all the steps for build test cases. Now we need to show the results for that you need to check ‘Publish JUnit test result report’ check box.

12. Enter the path where your reports generates.

13. Click on ‘Save’ button.

Ohh now you are ready for your first Build.

14. Click on ‘Build Now’ button and wait for the build to finish.

You can see the terminal output by clicking ‘Console Output’ link [in corresponding Build page].

Hope it will help you to configure selenium test cases through Hudson.

Categories: Hudson, Selenium
  1. November 27, 2012 at 4:09 am

    I will immediately grab your rss feed as I can’t find your e-mail subscription link or newsletter service. Do you have any? Please let me understand so that I may just subscribe. Thanks.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: