## NUnit

### Description

Runs the NUnit console test runner.

### Parameters

Attribute | Description | Required
vm | Same as dotnetexec's vm attribute. Specify the framework to use. | No.
config | Config file to use | No.
output | Where test output should go. | No.
error | Where test error output should go. | No.
xmlout | Where NUnit's XML output should go. | No.
transform | The transformation to apply. | No.
thread | Causes a separate thread to be created for running the tests - see the NUnit documentation for details. | No - defaults to false.
noshadow | Disables shadow copying of the assembly in order to provide improved performance.. | No - defaults to false.
fixture | Test fixture to run. | No.
labels | Causes an identifying label to be displayed at the start of each test case. | No - defaults to false.
failOnError | Stops the build if NUnit returns with a code indicating an error or failure. | No - defaults to false.

### Parameters specified as nested elements

#### testassembly

`testassembly` has a single required attribute name - specifies an assembly or a project file holding tests.

#### include/exclude

`in/exclude` have a single required attribute name - specifies a category to include or exclude from the tests.

Note that in current versions of NUnit (up to 2.2) you may choose to either include or exclude categories in a run, but not both. This task does not enforce this restriction since future versions of NUnit may change behavior.

#### redirector

A nested I/O Redirector can be specified. Any file mapping is done using a `null` sourcefile; therefore not all Mapper types will return results.

#### env

It is possible to specify environment variables to pass to the system command via nested `<env>` elements. They support the same attributes as the nested `env` element of the `<exec>` task.

### Examples

#### Specify an assembly or project:

          <nunit>
            <testassembly name="nunit.tests.dll"/>
          </nunit>

or

          <nunit>
            <testassembly name="nunit.tests.csproj"/>
          </nunit>

#### Specifying an Assembly and a Fixture

          <nunit fixture="NUnit.Tests.AssertionTests">
            <testassembly name="nunit.tests.dll"/>
          </nunit>

#### Specifying Test Categories to Include

          <nunit>
            <testassembly name="nunit.tests.dll"/>
            <include name="Baseline"/>
          </nunit>

#### Specifying the XML file name

          <nunit xmlout="console-test.xml">
            <testassembly name="nunit.tests.dll"/>
          </nunit>

changes the name of the output file to "console-test.xml" - note that this task will resolve file names relative to the project's base directory, not the current working directory.

#### Specifying Multiple Assemblies

          <nunit>
            <testassembly name="assembly1.dll"/>
            <testassembly name="assembly2.dll"/>
            <testassembly name="assembly3.dll"/>
          </nunit>

Copyright © 2004 The Apache Software Foundation. All rights Reserved.