NAnt is a build tool that may be employed to automatically build your ASP.NET project, run unit tests against it using NUnit, deploy the code to a staging server and run webpage "smoke tests" using NUnitAsp. (If you're not familiar with NAnt, It's often used in conjunction with CC.NET to establish your Continuous Integration environment.) The NUnitAsp smoke tests simply perform HTTP get requests to make sure that localhost and/or deployed pages aren't blatantly breaking. In my opinion, using NUnitAsp beyond creating an authentication session and running basic smoke tests causes a lot of unnecessary test-code maintenance.
When using NAnt, a typical objective is to automate the entire get/build/test/deploy/test-deployment process with a relatively clean deployment server. This ensures that configuration nuances aren't being "assumed to already be in place." Furthermore, by having your NAnt script perform as much configuration as possible, the build script acts as highly accurate and self-maintaining deployment documentation. One particular configuration nuance when setting up Castle MonoRail is to add the "*.rails" application extension mapping to IIS. This configuration must be in place to use NUnitAsp against your NAnt-deployed application. Although not trivial, configuring IIS with this application mapping can also be automated via NAnt.
After a bit of searching, I found that the developers of Selenium have figured this one out within http://svn.openqa.org/fisheye/rdiff/selenium?csid=261&u&N with a bit of C# scripting. The attached file, CreateIisAppMapping.build.xml, shows how NAnt can be used in conjunction with a call to NUnit to: create the IIS virtual directory, remove/add the "*.rails" application mapping, modify the test project's config file to point to the configured server, and run the unit tests - which presumably contain your NUnitAsp unit tests - against the application. The same testing technique can be used after the code has been deployed to make sure the deployed pages are working.
For further information on setting up your CI environment with NAnt and CC.NET, I recommend reading Expert .NET Delivery by Marc Holmes.
Billy McCafferty
Posted
07-13-2007 11:50 AM
by
Billy McCafferty