# <nunit>

(Deprecated)

Runs tests using the NUnit V1.0 framework.

See the NUnit home page for more information.

The `haltonfailure` or `haltonerror` attributes are only used to stop more than one test suite to stop running. If any test suite fails a build error will be thrown. Set `failonerror` to false to ignore test errors and continue build.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
haltonerror | bool | Stops running tests when a test causes an error. The default is false. | False
haltonfailure | bool | Stops running tests if a test fails (errors are considered failures as well). The default is false. | False
timeout | int | Cancel the individual tests if they do not finish in the specified time (measured in milliseconds). Ignored if fork is disabled. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Nested Elements:

#### <test>

Tests to run.

Represents a test element of an <nunit> task.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
assembly | string | Assembly to load the test from. | True
class | string | Class name of the test. | True
appconfig | string | The application configuration file to use for the NUnit test domain. | False
fork | bool | Run the tests in a separate AppDomain. | False
haltonerror | bool | Stop the build process if an error occurs during the test run. | False
haltonfailure | bool | Stop the build process if a test fails (errors are considered failures as well). | False
outfile | string | Base name of the test result. The full filename is determined by this attribute and the extension of formatter. | False
todir | string | Directory to write the reports to. | False

#### </test>

#### <formatter>

Formatters to output results of unit tests.

Represents the FormatterElement of the NUnit task.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
type | FormatterType | Type of formatter. | True
extension | string | Extension to append to the output filename. | False
outputdir | directory | Specifies the directory where the output file should be written to, if `usefile` is true. If not specified, the output file will be written to the directory where the test module is located. | False
usefile | bool | Determines whether output should be persisted to a file. The default is false. | False

#### </formatter>

### Examples

- Run tests in the `MyProject.Tests.dll` assembly.

  The test results are logged in `results.xml` and `results.txt` using the `Xml` and `Plain` formatters, respectively.

      <nunit basedir="build" verbose="false" haltonerror="true" haltonfailure="true">
          <formatter type="Xml" />
          <formatter type="Plain" />
          <test name="MyProject.Tests.AllTests" assembly="MyProject.Tests.dll" outfile="results"/>
      </nunit>

### Requirements

Assembly: NAnt.NUnit1Tasks (0.90.3780.0)