Integrating NUnit with CruiseControl.NET

There’s no clear, concise documentation on how to get NUnit working with CruiseControl.NET. So I figured I should write it, having gone through the pain of trying to figure everything out.

I assume you already:

  • Have a solution that builds in CC.NET
  • Have a project that builds the NUnit tests DLL

The recommended way of integration is not the nunit tag, but it’s via the exec tag. This supposedly will break less than using the nunit tag.

Here’s what you need to do:

Run NUnit in CruiseControl.NET

Add the following into your ccnet.config under tasks for your project:

C:\Program Files\NUnit 2.x.y.z\bin\net-2.0
C:\blah\blah\your.nunit.dll /xml:C:\blah\blah\nunit-results.xml

After executing the main build (MSbuild or whatever it is), this will invoke nunit-console and tell it to run the your.nunit.dll assembly’s tests, and to write the output to C:\blah\blah\nunit-results.xml.

The next step is to tell CruiseControl.NET to read this file and include it in the dashboard information. To do this, we need to add a publisher. As a point of extensibility, CruiseControl.NET allows you to merge any XML files into the build report; some, like NUnit, which it understands, it will display meaningfully.

To add a publisher, add the following after your tag:


This tells CruiseControl.NET to merge the C:\blah\blah\nunit-results.xml content into the main build XML.

And that should be it! Force a build, and you should see CC.NET reporting success/failure test statistics in the web dashboard.

About Ashiq Alibhai, PMP

Ashiq has been coding C# since 2005. A desktop, web, and RIA application developer, he's touched ASP.NET MVC, ActiveRecord, Silverlight, NUnit, and all kinds of exciting .NET technologies. He started C# City in order to accelerate his .NET learning.
This entry was posted in Silverlight, Tools, Web, Wndows Forms and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *