Sohan's Blog

Things I'm Learning

CruiseControl.Net (CCNet) Configuration Example for NCover

CruiseControl.Net is a great continuous integration tool for .Net projects. It not only continuously builds your software but provides some really helpful reports to monitor your project’s progress.

In agile world, we all speak of self-testing code or test driven development (TDD). If we really want to ensure our code has enough test coverage, we need to use some tool to ease our lives and NCover is a good one for this purpose. To learn more about NCover, please visit this.

When integrating to CCNet, you can use a similar configuration in ccnet.config as shown below to show NCover reports for your project-

\par ?? <\cf3 msbuild\cf1 >\par ?? <\cf3 executable\cf1 >\cf0 C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe\cf1 \par ?? <\cf3 projectFile\cf1 >\cf0 CISample.sln\cf1 \par ?? <\cf3 buildArgs\cf1 >\cf0 /p:Configuration=Debug\cf1 \par ?? <\cf3 targets\cf1 >\cf0 Rebuild\cf1 \par ?? <\cf3 timeout\cf1 >\cf0 300\cf1 \par ?? <\cf3 logger\cf1 >\cf0 C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll\cf1 \par ?? \par ??\par ?? \par ?? <\cf3 nunit\cf1 >\par ?? <\cf3 path\cf1 >\cf0 C:\Program Files\NUnit 2.4.1\bin\nunit-console.exe\cf1 \par ?? <\cf3 assemblies\cf1 >\par ?? <\cf3 assembly\cf1 >\cf0 CISample\bin\Debug\CISample.dll\cf1 \par ?? \par ?? \par ??\par ?? \par ?? <\cf3 exec\cf1 >\par ?? <\cf3 executable\cf1 >\cf0 ncover.console.exe\cf1 \par ?? <\cf3 baseDirectory\cf1 >\cf0 CISample\bin\Debug\\cf1 \par ?? <\cf3 buildArgs\cf1 >\cf0 nunit-console CISample.dll //xml coverage.xml //ea NUnit.Framework.TestFixtureAttribute\cf1 \par ?? \par ??\par ?? \par ?? <\cf3 exec\cf1 >\par ?? <\cf3 executable\cf1 >\cf0 NCoverExplorer.Console.exe\cf1 \par ?? <\cf3 baseDirectory\cf1 >\cf0 CISample\bin\Debug\\cf1 \par ?? <\cf3 buildArgs\cf1 >\cf0 coverage.xml /xml /r:ModuleMethodFunctionSummary\cf1 \par ?? \par ??\par ?? } –>

10 <tasks>

11 <!– Task for MSBuild –>

12 <msbuild>

13 <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>

14 <projectFile>CISample.sln</projectFile>

15 <buildArgs>/p:Configuration=Debug</buildArgs>

16 <targets>Rebuild</targets>

17 <timeout>300</timeout>

18 <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>

19 </msbuild>


21 <!– Task for NUnit –>

22 <nunit>

23 <path>C:\Program Files\NUnit 2.4.1\bin\nunit-console.exe</path>

24 <assemblies>

25 <assembly>CISample\bin\Debug\CISample.dll</assembly>

26 </assemblies>

27 </nunit>


29 <!– Task for NCover –>

30 <exec>

31 <executable>ncover.console.exe</executable>

32 <baseDirectory>CISample\bin\Debug\</baseDirectory>

33 <buildArgs>nunit-console CISample.dll //xml coverage.xml //ea NUnit.Framework.TestFixtureAttribute</buildArgs>

34 </exec>


36 <!– Task for NCoverExplorer –>

37 <exec>

38 <executable>NCoverExplorer.Console.exe</executable>

39 <baseDirectory>CISample\bin\Debug\</baseDirectory>

40 <buildArgs>coverage.xml /xml /r:ModuleMethodFunctionSummary</buildArgs>

41 </exec>


43 </tasks>

You see that there are two NCover related <exec> nodes. The first one generates the coverage.xml. Then using this first one you can create actual report to present specifying the desired level of details of the report.


Abhishek Tyagi
NUnit task in this example does not work.

The warning : warning MSB6003: The specified task executable could not be run. The directory name is invalid

the path is correct. can u help out in this issue thank you