Friday, October 1, 2010

CruiseControl.Net driving Selenium Tests

This is how you can quickly get CruiseControl.Net running and driving your selenium test – in 6 steps:

  1. Donwload & Install CruiseControl.Net
  2. Start “CruiseControl.NET Server“ Windows Service
  3. Download SeleniumTest sample project and extract it on a folder C:\Projects\.
  4. Edit CruiseControl.NET configuration file (C:\Program Files (x86)\CruiseControl.NET\server\ccnet.config) and replace it with the information in C:\Projects\SeleniumTest\CruiseControl.Net\ccnet.config. Modify it with proper locations of MSBuild.exe, MsBuild.dll and MSTest.exe 
  5. Start selenium server by running C:\Projects\SeleniumTest\SeleniumServerPort4441.bat.
  6. Open http://localhost/ccnet and you will se the project SeleniumSearchTest1 click on Force. It should build the project and start the tests.

The tests will run using chrome, you can change this parameter in C:\Projects\SeleniumTest\SeleniumSearch\SeleniumSearchTest.cs and use "*iehta" for Internet Explorer or  "*firefoxproxy" for Firefox.

// "*iehta" IE -  "*firefoxproxy" FF - *googlechrome
selenium = new DefaultSelenium("localhost", 4441, "*googlechrome", "");

This is how the ccnet.config file looks

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<scheduleTrigger time="23:30" buildCondition="ForceBuild">
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<executable>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe</executable>
<buildArgs> /testcontainer:SeleniumSearch\bin\Debug\SeleniumSearch.dll /resultsfile:Results\results1.xml</buildArgs>
<xmllogger />

This example applies for VS 2008 Professional, ccnet 1.5.7256.1 and Selenium RC 1.0.3



  1. Very nice.

    I followed the steps and tried to be clever using %programfiles%\..., don't do that.

    Enter the full path, or it won't work (error information is kind of cryptic i.e. Request processing has failed on the remote server: Unable to find Log Publisher for project so can't find log file).

  2. I suggest you to have a look at TeamCity instead of CruiseControl.
    As CruiseControl, Teamcity is free, but has a much better user interface, no more xml editing, much better logging system, can be easily integrated with JIRA (if you use JIRA as tracking tool).
    I do not work for or have anything to do with TeamCity, just had a long experience with both and nothing can beat Teamcity :)

  3. @eglasius thanks, I wasn't aware that alternative didn't work.

    @smnbss will take a look at TeamCity as well =).

  4. You can also look at using Hudson with the Selenium plug in - which are all free too :)