We are using CruiseControl.Net with NAnt on our continuous integration server.
- 'test' - specifies the test suite to run
- 'auto=true' - run as soon as the page loads
- 'resultsUrl' - tells selenium a page it can post the results to
- Run the selenium test from NAnt
- Detect when the tests have finished running
- Cause the build to fail if any tests failed
The PostResults.aspx is a simple ASP.Net page that saves the passed in test results out to a file in a well known location. The NAnt task then checks this file to see if any tests failed. If they did then it throws a Build Failure exception. If not it just completes successfully.
This worked really well.
Here is an excerpt from our NAnt script:
<exec program="taskkill" commandline='/FI "windowtitle eq Selenium*"' failonerror="false" />
I have been thinking of making the 'PostResults.aspx' page take the 'errorlogfile' uri as a parameter. Currently this filename is duplication. I would also like to allow the NAnt file to specify a timeout for the selenium process. I could also move the 'taskkill' logic into the NAnt task.
Here, you have a go:
Download the project from here.. (Update: Sorry this file was lost a couple of server moves ago. If anyone fancies giving writing it a go, let me know so I can reference it. It wasn't hard to write.)
- Drop the Selenium.Tasks.dll into your NAnt/bin folder.
- Put the above NAnt code in your NAnt script..
- Write yourself a PostResults page (check out the selenium site for details)
- Away you go.