NAnt
![]() ![]() ![]() |
v0.85 |
[This is preliminary documentation and subject to change.]
Runs tests using the NUnit V2.1 framework.
See the NUnit home page for more information.
The haltonfailure
or haltonerror
attributes are only used when more than one test suite is used. If any test suite fails, a build error will be thrown. Set failonerror
to false to ignore test errors and continue the build.
In order to run a test assembly built with NUnit 2.0 or 2.1 using the NAnt <nunit2> task , you must add the following node to your test config file :
<configuration> ... <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> <bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.0.0" /> <bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> ... </configuration>
Attribute | Type | Description | Required |
---|---|---|---|
haltonerror | bool | Build fails on error. The default is true. | False |
haltonfailure | bool | Stop the build process if a test fails. The default is false. | 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 |
Contains a strongly typed collection of NUnit2Test objects.
Contains a strongly typed collection of FormatterElement objects.
Run tests in the MyProject.Tests.dll
assembly.
<nunit2> <formatter type="Plain" /> <test assemblyname="MyProject.Tests.dll" appconfig="MyProject.Tests.dll.config" /> </nunit2>
Run all tests in files listed in the tests.txt
file.
<nunit2> <formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}/results" /> <test> <assemblies> <includesfile name="tests.txt" /> </assemblies> </test> </nunit2>