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=""${toolsdirectory}\\NUnit\\${nunit.version}\\bin\\nunit-console.exe"
"${outputdirectory}\\SomeAssy.dll"
"${outputdirectory}\\AnotherAssy.dll"
"${outputdirectory}\\OneMoreAssy.dll"
"${outputdirectory}\\Tests.dll"
/xml:"${resultsdirectory}\\nunit_results.xml"
//x "${resultsdirectory}\\coverage.xml""
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!