Skip to content
statianzo edited this page Jul 20, 2011 · 12 revisions

The XUnitTask is designed to run tests written with the xunit test framework.

How to use the XUnitTask

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

For example

desc "XUnit Test Runner Example"
xunit do |xunit|
	xunit.command = "XUnit/xunit.console.exe"
	xunit.assembly = "assemblies/TestSolution.XUnitTests.dll"
end

Configuration options

command (required)

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

assembly or assemblies(required)

You must provide a single assembly or array of assemblies for xunit to run. These should be assemblies that contain your [Fact]s. The xUnit runner does not allow more than one assembly to be specified, so command will be started for each individual assembly.

options (optional)

You can specify additional parameters for the xunit 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.

xunit.options '/someoption', '/anotheroption'

html_output (optional)

You can specify the folder to write an html report of the tests to.

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.