Dashboard > CruiseControl.NET > ... > Task Blocks > NUnit Task
NUnit Task Log In View a printable version of the current page.  
CruiseControl.NET documentation for latest CI builds
Added by Owen Rogers , last edited by Daniel Hommel on Aug 27, 2008  (view change)

See Using CruiseControl.NET with NUnit for more details.

This task enables you to instruct CCNet to run the unit tests contained within a collection of assemblies. The results of the unit tests will be automatically included in the CCNet build results. This can be useful if you have some unit tests that you want to run as part of the integration process, but you don't need as part of your developer build process. For example, if you have a set of integration tests that you want to run in a separate build process, it is easy to set up a project to use this task.

If you are using the Visual Studio Task and you want to run unit tests then you probably want to use this task. Alternatively you can run NUnit using post-build tasks in your Visual Studio project properties.

We recommend not using this task, and using your builder to run your tests if possible. This way if the tests fail and you don't know why, it is a lot easier to try and replicate the problem on another machine.

Configuration Elements

Node Description Type Required Default
assemblies List of the paths to the assemblies containing the NUnit tests to be run.* string[] true  
path Path of nunit-console.exe application. string false C:\Program Files\NUnit 2.2\bin\nunit-console.exe
outputfile The file that NUnit will write the test results to string false nunit-results.xml
timeout The number of seconds that the nunit process will run before timing out string false 600
includedCategories List of the test categories to be included in the NUnit run. The tests need to have the CategoryAttribute set. string false  
excludedCategories List of the test categories to be excluded from the NUnit run. The tests need to have the CategoryAttribute set. string false  

* Due to a limitation in the 2.2.x version of the nunit console, all test assemblies must be located in the same directory. The problem is that the nunit-console does not change the working directory before executing each assembly. As a result, dependencies for the subsequent assemblies will not be located by nunit. The options are to either a) include all assemblies to test in the same directory or b) to use separate NUnit Tasks for each assembly.

Configuration Example

The configuration for the NUnitTask should be placed in the <tasks> section of the Configuring the Server file.

<tasks>
    	<nunit>
    		<path>D:\dev\ccnet\ccnet\tools\nunit\nunit-console.exe</path>
    		<assemblies>
    			<assembly>D:\dev\Refactoring\bin\Debug\Refactoring.exe</assembly>
    			<assembly>D:\dev\Refactoring\bin\Debug\Refactoring.Core.dll</assembly>
    		</assemblies>
                <excludedCategories>
			<excludedCategory>LongRunning</excludedCategory>
		</excludedCategories>
    	</nunit>
    </tasks>

Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators