Skip to content
dariusdamalakas edited this page Mar 9, 2013 · 10 revisions

The NUnitTask is designed to run tests written with the nunit test framework.

How to use the NUnitTask

There are only a few pieces of information needed for the NUnitTask to operate correctly. Most notably are the path to the nunit-console executable, and a list of assemblies for nunit to run tests against.

For example

desc "NUnit Test Runner Example"
nunit do |nunit|
	nunit.command = "NUnit/nunit-console.exe"
	nunit.assemblies = "assemblies/TestSolution.Tests.dll"
end

Configuration options

command (required)

You must provide the location of the nunit console executable either through the constructor or via the .command setting.

assemblies (required)

You must provide at least one assembly for nunit to run. This should be the assembly that contains your [TestFixture]s and [Test]s.

You can wholesale replace the assemblies list with an array of dlls, or you can append individual dlls to the list. The following examples produce the same results.

Specify an array of assemblies

nunit.assemblies 'some.test.dll', 'another.test.dll', 'stillmore.tests.dll'

options (optional)

You can specify additional parameters for the nunit executable here. If the options require a “/”, “-”, or any other special character, be sure to include that in the option.

Like the assemblies setting, options is an array that can be wholesale replaced or appended to.

nunit.options '/someoption', '/anotheroption'

A particularly useful way of using the options parameter is to set the name of the xml report NUnit generates.

nunit.options '/xml=MyProject.Tests-results.xml'

YAML configuration

This task supports configuration via an external YAML file. For more information, see the yamlconfig page.

Command Line Options

This task supports additional command line options, including a .parameters collection for passing in options that are not directly supported. For more information, see the commandline task options documentation.