Covering NUnit on your Build Server
A good solution for covering NUnit tests on your build server is the NCover Run command:
- First, create a project in Code Central where the coverage results will be sent and displayed:
- On the "Processes" tab of the new project, click "Edit Match Rules"
- Add a match rule of Match type="Regex", Process matching="nunit-agent."
- Save the project (which will be automatically synced to all Collectors), then start building your NCover Run command.
Here's a blog post that explains the use of the NCover Run command: http://blog.ncover.com/the-ncover-run-command/
Basically, the NCover Run command:
- Tells the Collector on your build server to profile NUnit.
- Sends the coverage results to the Code Central project you specify (the one you created above).
The first part of the NCover Run command is the (required) NCover project, the second half is the profiled application (NUnit). Use the same syntax in the second part of the Run command that you would use to run NUnit from the command line.
So, a very basic NCover Run command will look something like this:
ncover run --project="MyNUnitProject" -- "nunit-console-x86.exe" "UnitTest.dll"
Try NCover Run from the command line first, which will make it much easier to troubleshoot than running it from the NAnt build script.
When NCover runs successfully, coverage will be collected on NUnit and displayed in your project in Code Central.
Once NCover Run is working as expected from the command line, add it to your build script as an < exec > and test again.