I wanted to get our WatiN acceptance tests to run as part of a CC.Net build. It was a bit harder than I thought to get the web server up and running before the tests ran so I thought I'd document the steps.
- Get WebDev.WebHost.dll and WebDev.WebServer2.exe into you solution folder somewhere (I chose SharedLibs\WebServer)
- Create a batch file (startserver.bat) that has the line:
start
SharedLibs\WebServer\WebDev.WebServer2.exe
/port:3699 /path:%~dp0MyProject.Web - Download the Async exec task from here. Add it to your solution structure. I put it in SharedLibs\MSBuild.
- Add a reference to the AsyncExec task to your ms build file:
<UsingTask AssemblyFile="SharedLibs\MSBuild\AsyncExec.dll" TaskName="AsyncExec.AsyncExec" /> - Execute and kill the server in the msbuild file like this:
<AsyncExec Command="startserver.bat" /> <Exec ... tests .../> <Exec Command="taskkill /F /IM WebDev.WebServer2.exe"
IgnoreExitCode="true" />
Notes:
- Another method might have been to get an IIS site running, but all the tests were set up for local developers to run with the built-in server.
- The Async exec task is needed as the built-in msbuild task never returns
- The kill command kills all webdev instances. This was OK for my solution but may not be for yours!


0 Responses:
Post a Comment