NAnt SDK Documentation - v0.92 |

# NUnitTask Class

NOTE: This class is now obsolete.

In a future release, this task will be moved to NAntContrib. However, we strongly advise you to upgrade to NUnit 2.x.

Runs tests using the NUnit V1.0 framework.

For a list of all members of this type, see NUnitTask Members.

System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.NUnit1.Tasks.NUnitTask

[Visual Basic]
<Obsolete(Message:="In a future release, this task will be moved to NAntContrib. However, we strongly advise you to upgrade to NUnit 2.x.", IsError:=False), _ TaskName(Name:="nunit")>
Public Class NUnitTask
Inherits Task
[C#]
[Obsolete(Message="In a future release, this task will be moved to NAntContrib. However, we strongly advise you to upgrade to NUnit 2.x.", IsError=False)]
[TaskName(Name="nunit")]
public class NUnitTask : Task

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Remarks

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.

#### Example

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

Namespace: NAnt.NUnit1.Tasks

Assembly: NAnt.NUnit1Tasks (in NAnt.NUnit1Tasks.dll)

#### See Also

NUnitTask Members | NAnt.NUnit1.Tasks Namespace