I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success.
The error I get is the following :
[nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests.
Of course, the assembly contains tests that I can run from any runner, like NUnit one, TestDriven or Resharper. I would like to use <nunit2> task, and not directly the <exec> one, but I'm wondering if it is still possible, even using app.config files to bind assembly versions.
The NUnit 3.0 framework can run tests in parallel within an assembly. This is a completely separate facility from Engine Parallel Test Execution, although it is possible to use both in the same test run. By default, no parallel execution takes place.
Ordered tests are started in ascending order of the order argument. Among tests with the same order value or without the attribute, execution order is indeterminate.
I can't remember why, but I gave up on using the <nunit2> task and I've been using the <exec> task and nunit-console.exe happily. If it helps, here's my test target that runs NUnit and FxCop. Note that it skips them if the executables aren't in the Windows path.
<target name="test" description="Run unit tests" depends="build">
<property name="windows-path" value="${string::to-lower(environment::get-variable('PATH'))}"/>
<property name="nunit-in-path"
value="${string::contains(windows-path, 'nunit')}"/>
<echo message="Tests skipped because no NUnit folder was found in the Windows path."
unless="${nunit-in-path}"/>
<exec program="nunit-console.exe" if="${nunit-in-path}">
<arg file="../MyProject/MyProjectTest.nunit"/>
</exec>
<property name="fxcop-in-path"
value="${string::contains(windows-path, 'fxcop')}"/>
<echo message="FxCop skipped because no FxCop folder was found in the Windows path."
unless="${fxcop-in-path}"/>
<fxcop projectFile="../MyProject/MyProject.fxcop" directOutputToConsole="true"
failOnAnalysisError="true" if="${fxcop-in-path}"/>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With