We just finished figuring out how to get around this problem. We now have watin tests running through CruiseControl.net that work as a service.
We need our cc.net service to run as a specific user to access the website we are testing because of how security is configured. Because the service works as a domain user, the "Allow user to interact with the desktop" checkbox is disabled on the serviceβs security tab. We do not want to simply start the team process from an always registered user, because we want the process to start automatically when it reboots. Now we have figured out
We worked on this by first creating a batch file to call nunit-console.exe. The parameters for nunit-console.exe are passed to the batch file as parameters, which then pass the parameters. The second and last line of the batch file returns the return code returned from nunit-console.exe. The batch file looks something like this:
nunit-console.exe %1 %2 exit /b %ERRORLEVEL%
The number of parameters you pass to nunit-console may vary depending on your needs.
We use nant for our builds, so we replaced our existing nant task with a nunit-console call with an exec task that calls cmd.exe, which looks like this:
<exec program="cmd.exe" failonerror="true"> <arg value="/interactive" /> <arg value="/c" /> <arg value="[batch file name]" /> <arg value="[parameter one value]" /> <arg value="[parameter two value" /> </exec>
I don't know what the task will look like in msbuild, but I'm sure you can find it. The end result is a command that looks like this:
cmd.exe /interactive /c [batch file name] [parameter one value] [parameter two value]
Alternatively, you can use nant and just create msbuld nant tasks to invoke existing assemblies.
The '/ interactive' parameter for cmd.exe is the key; it runs the batch file in a process that has permission to interact with the desktop. I'm actually not sure if the / c option is required, but it works as it is. We still tell nunit to write the results to the same XML file so that our merge task does not need to be changed, and reporting the test results for cruise control works fine.