Runs the NUnit console test runner.
| 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. |
| errorProperty | Name of the Ant property to set if one of the tests fails/causes an error. Only useful if the failOnError attribute is set to false. | No. |
testassembly has a single required attribute name -
specifies an assembly or a project file holding tests.
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.
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.
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.
<nunit>
<testassembly name="nunit.tests.dll"/>
</nunit>
or
<nunit>
<testassembly name="nunit.tests.csproj"/>
</nunit>
<nunit fixture="NUnit.Tests.AssertionTests">
<testassembly name="nunit.tests.dll"/>
</nunit>
<nunit>
<testassembly name="nunit.tests.dll"/>
<include name="Baseline"/>
</nunit>
<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.
<nunit>
<testassembly name="assembly1.dll"/>
<testassembly name="assembly2.dll"/>
<testassembly name="assembly3.dll"/>
</nunit>
Apache Ant, Apache .NET Ant Library, Ant, .NET Ant Library, Apache, the Apache feather logo, and the Apache Ant project logos are trademarks of The Apache Software Foundation.