Integrating Selenium Tests into CruiseControl.Net via NUnit

Getting Selenium and CruiseControl.Net to talk to each other requires some work and behind-the-scenes configuration. Before incorporating Selenium tests into CruiseControl.Net, make sure you:

To successfully get Selenium, NUnit and CruiseControl.Net talking to each other, you will have to accomplish the following:

  1. Configure Selenium RC to run as a service
  2. Edit your CruiseControl.Net config file to include a NUnit task
  3. Point NUnit to your Selenium Unit Test Library

The details of this article help to get you started in accomplishing the tasks above.

Running Selenium RC as a service

By default, Selenium RC runs as a stand-alone application capable of managing Selenium unit tests and directing traffic for different browser requests. If you want to incorporate your Selenium tests into CruiseControl.Net, you have to get Selenium RC running as a service.

I found a great resource that details how to do this. To summarize the article, follow these simple steps:

  1. Download a copy of the Windows Resource Kit.
  2. Register the new service “SeleniumRC”

    "C:\Program Files\Windows Resource Kits\Tools\instsrv.exe" SeleniumRC
    "C:\Program Files\Windows Resource Kits\Tools\srvany.exe" -a [myuser] -p [mypass]
    
  3. Edit your registry to include the path of your Selenium RC installation and executable:

    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SeleniumRC\Parameters]
    "Application"="java.exe"
    "AppDirectory"="C:\\Program Files\\selenium-server-1.0.1"
    "AppParameters"="-Xrs -jar selenium-server.jar"
    
  4. Now that you have the Selenium RC service created, go to Administrative Tools > Services and start the service. Check the system event logs for errors to ensure everything is working properly.

    Wire-Up Selenium to CruiseControl.Net using NUnit

    With the Selenium RC service running, edit your CruseControl.Net config file to incorporate NUnit:

    
    

        <tasks>

          <exec>

            <executable>C:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0\nunit-console.exe</executable>

            <buildArgs>"C:\Users\Dave\Documents\Visual Studio 2008\Projects\SeleniumTest\SeleniumTest\bin\Debug\SeleniumTest.dll"</buildArgs>

          </exec>

        </tasks>

    After a successful execution of your test plan using Selenium RC in CruiseControl.Net, you should see a response from NUnit in your CruiseControl.Net build log like the following:

    <buildresults>
      <message>NUnit version 2.5.5.10112</message>
      <message>Copyright (C) 2002-2009 Charlie Poole.</message>
      <message>Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.</message>
      <message>Copyright (C) 2000-2002 Philip Craig.</message>
      <message>All Rights Reserved.</message>
      <message>Runtime Environment - </message>
      <message>   OS Version: Microsoft Windows NT 6.1.7600.0</message>
      <message>  CLR Version: 2.0.50727.4927 ( Net 2.0 )</message>
      <message>ProcessModel: Default    DomainUsage: Single</message>
      <message>Execution Runtime: net-2.0</message>
      <message>.</message>
      <message>Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 20.9481982 seconds</message>
      <message>  Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0</message>
    </buildresults>
    </build>
    </cruisecontrol>
    
    Advertisements

About Dave
Certified Sitecore Developer.

4 Responses to Integrating Selenium Tests into CruiseControl.Net via NUnit

  1. Pingback: A Smattering of Selenium #21 « Official Selenium Blog

  2. Pingback: Tweets that mention Integrating Selenium Tests into CruiseControl.Net via NUnit « Everything Web -- Topsy.com

  3. Pingback: A Smattering of Selenium #24 « Official Selenium Blog

  4. Pingback: Confluence: CoreTech

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: