<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- Documenting T:NAnt.NUnit1.Tasks.NUnitTask--> <head> <meta http-equiv="Content-Language" content="en-ca" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../style.css" /> <title><nunit> Task</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar"> <tr> <td class="NavBar-Cell"> <a href="http://nant.sourceforge.net"> <b>NAnt</b> </a> <img alt="->" src="../images/arrow.gif" /> <a href="../index.html">Help</a> <img alt="->" src="../images/arrow.gif" /> <a href="../tasks/index.html">Task Reference</a> <img alt="->" src="../images/arrow.gif" /> <nunit></td> <td class="NavBar-Cell" align="right"> v0.90</td> </tr> </table> <h1><nunit></h1> <p> <i>(Deprecated)</i> </p> <p> Runs tests using the NUnit V1.0 framework. </p> <p> See the <a href="http://nunit.sf.net">NUnit home page</a> for more information. </p> <p> The <code>haltonfailure</code> or <code>haltonerror</code> 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 <code>failonerror</code> to <b>false</b> to ignore test errors and continue build. </p> <h3>Parameters</h3> <div class="table"> <table> <tr> <th>Attribute</th> <th style="text-align: center;">Type</th> <th>Description</th> <th style="text-align: center;">Required</th> </tr> <tr> <td valign="top">haltonerror</td> <td style="text-align: center;">bool</td> <td> Stops running tests when a test causes an error. The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">haltonfailure</td> <td style="text-align: center;">bool</td> <td> Stops running tests if a test fails (errors are considered failures as well). The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">timeout</td> <td style="text-align: center;">int</td> <td> Cancel the individual tests if they do not finish in the specified time (measured in milliseconds). Ignored if fork is disabled. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">failonerror</td> <td style="text-align: center;">bool</td> <td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">if</td> <td style="text-align: center;">bool</td> <td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">unless</td> <td style="text-align: center;">bool</td> <td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">verbose</td> <td style="text-align: center;">bool</td> <td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> </table> </div> <h3>Nested Elements:</h3> <!--Array--> <!--NestedElementArray=T:NAnt.NUnit1.Types.NUnitTest--> <h4> <a id="test"> </a> <test> </h4> <div class="nested-element"> Tests to run. <p> Represents a test element of an <a href="../tasks/nunit.html"><nunit></a> task. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">assembly</td><td style="text-align: center;">string</td><td> Assembly to load the test from. </td><td style="text-align: center;">True</td></tr><tr><td valign="top" class="required">class</td><td style="text-align: center;">string</td><td> Class name of the test. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">appconfig</td><td style="text-align: center;">string</td><td> The application configuration file to use for the NUnit test domain. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">fork</td><td style="text-align: center;">bool</td><td> Run the tests in a separate <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemAppDomainClassTopic.asp">AppDomain</a>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">haltonerror</td><td style="text-align: center;">bool</td><td> Stop the build process if an error occurs during the test run. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">haltonfailure</td><td style="text-align: center;">bool</td><td> Stop the build process if a test fails (errors are considered failures as well). </td><td style="text-align: center;">False</td></tr><tr><td valign="top">outfile</td><td style="text-align: center;">string</td><td> Base name of the test result. The full filename is determined by this attribute and the extension of formatter. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">todir</td><td style="text-align: center;">string</td><td> Directory to write the reports to. </td><td style="text-align: center;">False</td></tr></table></div></div> <h4> <a id="test"> </a> </test> </h4> <!--Array--> <!--NestedElementArray=T:NAnt.NUnit.Types.FormatterElement--> <h4> <a id="formatter"> </a> <formatter> </h4> <div class="nested-element"> Formatters to output results of unit tests. <p> Represents the FormatterElement of the NUnit task. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">type</td><td style="text-align: center;"><a href="../enums/NAnt.NUnit.Types.FormatterType.html">FormatterType</a></td><td> Type of formatter. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">extension</td><td style="text-align: center;">string</td><td> Extension to append to the output filename. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">outputdir</td><td style="text-align: center;">directory</td><td> Specifies the directory where the output file should be written to, if <code>usefile</code> is <b>true</b>. If not specified, the output file will be written to the directory where the test module is located. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">usefile</td><td style="text-align: center;">bool</td><td> Determines whether output should be persisted to a file. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div> <h4> <a id="formatter"> </a> </formatter> </h4> <h3>Examples</h3> <ul class="examples"> <li> <p> Run tests in the <code>MyProject.Tests.dll</code> assembly. </p> <p> The test results are logged in <code>results.xml</code> and <code>results.txt</code> using the <code>Xml</code> and <code>Plain</code> formatters, respectively. </p> <pre class="code"> <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> </pre> </li> </ul> <h3>Requirements</h3> <div style="margin-left: 20px;"> <b>Assembly:</b> NAnt.NUnit1Tasks (0.90.3780.0) </div> </body> </html>