all posts

An update to my WatiN experience

Published to Blog on 12 Mar 2007

A few days ago I wrote of my initial impressions with WatiN. While I really like it, I mentioned that I had some trouble getting the tests to run under Cruise Control .NET.

Over the weekend the author, director and admin of the WatiN project, Jeroen van Menen, commented to my original post that he runs all the WatiN build with CC.NET and NAnt and he has no problems doing so. First, I’m honored that he stopped by my little piece of the web. Second, based on his comments I decided to give my implementation another look.

My NAnt NCover / NUnit task looks like the following:

<exec program="${toolsdirectory}\\NCover\\${ncover.version}\\ncover.console.exe"
commandline="&quot;${toolsdirectory}\\NUnit\\${nunit.version}\\bin\\nunit-console.exe&quot;
    &quot;${outputdirectory}\\SomeAssy.dll&quot;
    &quot;${outputdirectory}\\AnotherAssy.dll&quot;
    &quot;${outputdirectory}\\OneMoreAssy.dll&quot;
    &quot;${outputdirectory}\\Tests.dll&quot;
    /xml:&quot;${resultsdirectory}\\nunit_results.xml&quot;
    //x &quot;${resultsdirectory}\\coverage.xml&quot;"
failonerror="false" />

If you know anything about NAnt you can figure out what this does. If you have any questions feel free to comment below or email me and I will do my best to answer them.

That line was having problems running my WatiN tests, which was a set of NUnit tests in a separate assembly, the Tests.dll assy shown in the list. To troubleshoot I started by moving that entire command to a batch file and running the batch file instead. In doing so, I removed references to all the other dll’s except for my Tests.dll. It worked!  I added back all the other dll’s and it failed! I got rid of the batch file and moved everything back into my NAnt script and I saw the same thing: when I tested just my assembly that included my WatiN tests it would work fine, when I tried to test additional assemblies it would throw the threading error that I pointed out before and that is described on the WatiN sourceforge site.

So, I am now able to run my WatiN tests under CC.NET, I will just have to break out those UI tests into a different assembly away from the rest of my unit tests, which is a good idea anyway. Then I’ll have to change my CC.NET setup to be able to import and display both sets of tests separately. I may have to tweak the XSL files a bit to be able to do that. I haven’t done any searching yet, but I imagine there is someone out there who has implemented multiple sets of unit tests in their CC.NET process and reported about doing so.

I have to reiterate how much I am digging WatiN. Very, very good stuff. Plus, I just like watching IE windows fire up from out of nowhere from time to time when CC.NET kicks off a build!


Dan Hounshell
Web geek, nerd, amateur maker. Likes: apis, node, motorcycles, sports, chickens, watches, food, Nashville, Savannah, Cincinnati and family.
Dan Hounshell on Twitter


  • On 26 Mar 2007 "Tobias"" said:
    Are you running CC.NET as a service or starting it via the command prompt? qoute from Jeroen found here http//www.codeproject.com/useritems/WatiN.asp?df=100&forumid=373680&exp=0&select=1848529xx1848529xx "Using WatiN with CC.Net is possible. My advise is to start CC.Net from a command promt instead of running it as a service. Although running it as a service is possible as long as you don't need to automate pop up windows like alert and confirm dialog, logon dialog, print dialog e.a. A genuine UI session is needed to succesfully automate these. There has been some discussion on the mailing list about trying to resolve this, but with no results until now."
  • On 26 Mar 2007 "Tobias"" said:
    Sorry. I found the answer to my previous question in your previous Watir blog in the comments. You are starting CC.NET via the Console as far as I can see.
  • On 26 Mar 2007 """ said:
    Tobias, yes you are correct. I actually setup a batch file that runs on startup that runs cc.net via the console.
  • On 26 Jan 2009 "sam"" said:
    I was having Timeout error while running cc.net. Its solved when i run it as a service but Still I am getting TestFixtureSetUp failed errors and also failing to handle popups. Plz help me in this regard
  • On 6 Aug 2009 "Brett"" said:
    I figured out how to get waitin tests to run with cc net running as a service. stackoverflow.com/.../1241329