Gallio.MSBuildTasks
An MSBuild task that provides support for running Gallio tests.
In order for MSBuild to find this task, the Gallio.MSBuildTasks.dll has to be loaded with
the UsingTask directive:
]]>
The AssemblyFile attribute must be set to the path where the Gallio.MSBuildTasks.dll assembly resides,
and the TaskName attribute must be set to "Gallio", otherwise MSBuild won't load the task.
The following code is an example build file that shows how to load the task, specify the test files
and assemblies and set some of the task's properties:
]]>
Default constructor.
Provided so that the unit tests can override test execution behavior.
The list of relative or absolute paths of test files, projects and assemblies to execute.
Wildcards may be used. This is required.
The following example shows how to specify the test files, projects and assemblies
(for a more complete example please see the task documentation):
]]>
The list of directories used for loading referenced assemblies and other dependent resources.
The following example shows how to specify the hint directories:
]]>
Additional Gallio plugin directories to search recursively.
The following example shows how to specify the plugins directories:
]]>
Gets or sets the relative or absolute path of the application base directory,
or null to use a default value selected by the consumer.
If relative, the path is based on the current working directory,
so a value of "" causes the current working directory to be used.
The default is null.
Gets or sets the relative or absolute path of the working directory
or null to use a default value selected by the consumer.
If relative, the path is based on the current working directory,
so a value of "" causes the current working directory to be used.
The default is null.
Enables shadow copying when set to true.
Shadow copying allows the original assemblies to be modified while the tests are running.
However, shadow copying may occasionally cause some tests to fail if they depend on their original location.
The default is false.
Attaches the debugger to the test process when set to true.
The default is false.
Gets or sets the version of the .Net runtime to use for running tests.
For the CLR, this must be the name of one of the framework directories in %SystemRoot%\Microsoft.Net\Framework. eg. 'v2.0.50727'.
The default is null which uses the most recent installed and supported framework.
A list of the types of reports to generate, separated by semicolons.
- The types supported "out of the box" are: Html, Html-Condensed, Text, Text-Condendes, XHtml,
XHtml-Condensed, MHtml, MHtml-CondensedXml, and Xml-Inline, but more types could be available as plugins.
- The report types are not case sensitive.
In the following example reports will be generated in both HTML and XML format:
]]>
Sets the report archive mode.
The supported modes are:
- Normal (default)
- Zip
In the following example, reports will be enclosed in a zip file:
]]>
Sets the format string to use to generate the reports filenames.
Any occurence of {0} will be replaced by the date, and any occurrence of {1} by the time.
The default format string is test-report-{0}-{1}.
Sets the name of the directory where the reports will be put.
The directory will be created if it doesn't exist. Existing files will be overwritten.
The default report directory is "Reports".
Sets the type of test runner to use.
- The types supported "out of the box" are: Local, IsolatedAppDomain
and IsolatedProcess (default), but more types could be available as plugins.
- The runner types are not case sensitive.
Specifies the type, assembly, and parameters of custom test runner
extensions to use during the test run in the form:
'[Namespace.]Type,Assembly[;Parameters]'.
eg. 'FancyLogger,MyCustomExtensions.dll;SomeParameters'
Since semicolons are used to delimit multiple property values in MSBuild,
it may be necessary to escape semicolons that appear as part of test
runner extension specifications to ensure MSBuild does not misinterpret them.
An escaped semicolon may be written as "%3B" in the build file.
The following example runs tests using a custom logger extension:
]]>
Specifies option property key/value pairs for the test runner.
The following example specifies some extra NCover arguments.
]]>
Specifies option property key/value pairs for the report formatter.
The following example changes the default attachment content disposition for the reports.
]]>
Sets the filter set to apply, which consists of a sequence of one or more inclusion
or exclusion filter rules prefixed using 'include' (optional) or 'exclude'.
A filter rule consists of zero or more filter expressions
that may be combined using 'and', 'or', and 'not' and grouped with
parentheses. A filter expression consists of a filter key followed by one or
more comma-delimited matching values in the form 'key: value, "quoted value",
/regular expression/'.
The filter grammar is defined as follows:
::= [^:,*()/\"']+
::= '"' .* '"' # String delimited by double quotation marks
| "'" .* "'" # String delimited by single quotation marks
::=
|
::= "/" .* "/" # Regular expression
| "/" .* "/i" # Case-insensitive regular expression
::=
::= # Value specified by exact string
| # Value specified by regular expression
::= (',' )* # One or more comma-separated values
::= "*" # "Any"
| ":" matchSeq>
| OR filterExpr> # Combine filter expressions with OR
| AND filterExpr> # Combine filter expressions with AND
| NOT # Negate filter expression
| "(" ")" # Grouping filter expression
::= # Inclusion rule (default case)
| INCLUDE # Inclusion rule
| EXCLUDE # Exclusion rule
::= # Filter set consists of at least one filter rule.
| # But may be a sequence of rules.
]]>
- By default this property takes the value "*", which means the "Any" filter will be applied.
-
The operator precedence is, from highest to lowest: NOT, AND, and OR. All these operators are
left-associative.
-
The commas used to separate the values are interpreted as OR operators, so "Type:Fixture1,Fixture2"
is equivalent to "Type:Fixture1 or Type:Fixture2".
-
White-space is ignored outside quoted strings, so "Type:Fixture1|Type:Fixture2" is equivalent
to "Type : Fixture1 | Type : Fixture2".
-
Commas, colons, slashes, backslashes and quotation marks can be escaped with a backslash. For
example, \' will be interpreted as '. Using a single backslash in front of any other character
is invalid.
-
Currently the following filter keys are recognized:
- Id: Filter by id.
- Name: Filter by name.
- Assembly: Filter by assembly name.
- Namespace: Filter by namespace name.
- Type: Filter by type name, including inherited types.
- ExactType: Filter by type name, excluding inherited types.
- Member: Filter by member name.
-
*: All other names are assumed to correspond to metadata keys. See for standard metadata keys. Common keys are: AuthorName, Category, Description, Importance, TestsOn.
Assuming the following fixtures have been defined:
The following filters could be applied:
-
Type: Fixture1
All the tests within Fixture1 will be run.
-
Member: Test1
Only Fixture1.Test1 and Fixture2.Test1 will be run.
-
Type: Fixture1, Fixture2
All the tests within Fixture1 or Fixture2 will be run.
-
Type:Fixture1 or Type:Fixture2
All the tests within Fixture1 or Fixture2 will be run.
-
Type:Fixture1, Fixture2 and Member:Test2
Only Fixture1.Test2 and Fixture2.Test2 will be run.
-
Type:/Fixture*/ and Member:Test2
Only Fixture1.Test2 and Fixture2.Test2 will be run.
-
AuthorName:AlbertEinstein
All the tests within Fixture1 will be run because its author attribute is set to "AlbertEinstein".
-
Category: IntegrationTest
All the tests within Fixture2 will be run because its category attribute is set to "IntegrationTest".
-
("Type": 'Fixture1' and "Member":/Test*/) or (Type : Fixture2 and Member: /Test*/)
All the tests will be run. This example also shows that you can enclose key and
values with quotation marks, and group expressions with parentheses.
-
exclude AuthorName: AlbertEinstein
All the tests within Fixture2 will be run because its author attribute is not set to "AlbertEinstein".
-
exclude Type: Fixture2 include Member: Test2
Only Fixture1.Test2 will be run because Fixture2 was excluded from consideration before the inclusion rule was applied.
Sets whether test failures will be ignored and allow the build to proceed.
When set to false, test failures will cause the build to fail.
Sets whether to show generated reports in a window using the default system application
registered to the report file type.
Sets whether to load the tests but not run them. This option may be used to produce a
report that contains test metadata for consumption by other tools.
Sets whether to ignore annotations when determining the result code.
If false (default), then error annotations, usually indicative of broken tests, will cause
a failure result to be generated.
Sets whether to echo results to the screen as tests finish. If this option is set
to true, the default, test results are echoed to the console
in varying detail depending on the current verbosity level. Otherwise
only final summary statistics are displayed.
Sets the maximum amount of time (in seconds) the tests can run
before they are canceled. The default is an infinite time to run.
The verbosity to use when logging. The default is "Normal".
Gets the exit code of the tests execution.
This property is only meaningful when the IgnoreFailures property is set to true.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases run.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test steps run.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases that were run and passed.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases that were run and failed.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases that ran and were inconclusive.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases that were run.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the total number of test cases that did not run because they were skipped.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the duration of the tests execution in seconds.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
Gets the number of assertions evaluated.
To use this property, you need to include an Output tag within the
Gallio tag to specify a name to reference it:
]]>
The Gallio.MSBuildTasks namespace contains MSBuild tasks for Gallio.
Logs messages to a instance.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to test-report-{0}-{1}.
Looks up a localized string similar to Gallio MSBuild Task - Version {0}.
Looks up a localized string similar to An unexpected error occurred during execution of the Gallio task..
Logs messages to a instance
for test results.