<csunit /> Task

This short document describes how to use the <csunit /> task, it assumes that you already have a working knowledge of csUnit and NAnt.

Single Assemblies

If you have an assembly that contains unit tests but no recipe file then you can execute the tests contained in that assembly using the following syntax.

<csunit assembly="MyCompany.MyApplication.Tests.dll" />

The test results will be output to the NAnt log. If you want to keep a copy of the XML report file generated by csUnit then you can specify an output attribute.

<csunit assembly="MyCompany.MyApplication.Tests.dll" output="MyCompany.MyApplication.Tests-results.xml" />

Recipe Files

The <csunit /> task also supports using recipe files. To use a recipe file use a recipe attribute instead of an assembly attribute.

<csunit recipe="MyApplication.recipe" />

FileSets

If you have a directory structure containing test assemblies but no recipe file then you can use the file-set approach with csUnit, it works like other uses of file-set's in NAnt.

<csunit>
   <assemblies>
           <includes name="**/*.dll" />
   </assemblies>
</csunit>

Feedback

If you have any feedback on this NAnt task I would be very happy to hear it. and let me know what you think. I'd really love to hear what people think the task should output to the NAnt log file since there isn't really a standard approach.