Skip to content
haf edited this page Feb 19, 2012 · 17 revisions

The MSpecTask is designed to run tests written with the mspec test framework.

How to use the MSpecTask

There are only a few pieces of information needed for the MSpecTask to operate correctly. Most notably are the path to the console runner executable, and a list of assemblies for mspec to run tests again.

For example

desc "MSpec Test Runner Example"
mspec do |mspec|
	mspec.command = "src/packages/Machine.Specifications.0.5.3.0/tools/mspec-clr4.exe"
	mspec.assemblies "build/net40/TestSolution.MSpecTests.dll"
end

Configuration options

command (required)

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

assemblies (required)

You must provide at least one assembly for mspec to run.

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

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

Split across multiple lines:

mspec.assemblies(
  'some.test.dll',
  'another.test.dll',
  'stillmore.tests.dll'
)

Documentation on options

options (optional)

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

mspec.options '/someoption', '/anotheroption'

or

mspec.options(
  '/someoption',
  '/anotheroption'
)

Documentation on options: https://github.com/machine/machine.specifications

html_output (optional)

You can specify the folder to write an html report of the specifications 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.