Icon

You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can pass the following command line options to the TeamCity NUnit Test Launcher:

Code Block

${teamcity.dotnet.nunitlauncher} <.NET Framework> <platform> <NUnit vers.> [/category-include:<list>] [/category-exclude:<list>] [/addin:<list>] <assemblies to test>

Option

Description

<.NET Framework>

Version of .NET Framework to run tests. Acceptable values are v1.1, v2.0, v4.0 or ANY.

<platform>

Platform to run tests. Acceptable values are x86, x64 and MSIL.

Note

For .NET Framework 1.1 only MSIL option is available.

<NUnit vers.>

Test framework to use. The value has to be specified in the following format: NUnit-<version>.

Excerpt Include
NUnit Support
NUnit Support
nopaneltrueNUnit Support

/category-include:<list>

The list of categories separated by ';,' (optional). Category expression are supported since NUnit v2.4.6.

/category-exclude:<list>

The list of categories separated by ';,' (optional). Category expression are supported since NUnit v2.4.6.

/addin:<list>

List of third-party NUnit addins to use (optional).

<assemblies to test>

List of assemblies paths separated by ';' or space.

/runAssemblies:processPerAssembly

Specify, if you want to run each assembly in a new process.

Category Expression

Beginning with NUnit 2.4.6, you may use a Category Expression. The table shows some examples:

ExpressionAction
A|B|CSelects tests having any of the categories A, B or C.
A,B,CSelects tests having any of the categories A, B or C.
A+B+CSelects only tests having all three of the categories assigned
A+B|CSelects tests with both A and B OR with category C.
A+B-CSelects tests with both A and B but not C.
-ASelects tests not having category A assigned
A+(B|C)Selects tests having both category A and either of B or C
A+B,CSelects tests having both category A and either of B or C

Note: As shown by the last two examples, the comma operator is equivalent to | but has a higher precendence. Order of evaluation is as follows:

  1. Unary exclusion operator (-)
  2. High-precendence union operator (,)
  3. Intersection and set subtraction operators (+ and binary -)
  4. Low-precedence union operator (|)

Note: Because the operator characters have special meaning, you should avoid creating a category that uses any of them in it's name. For example, the category "db-tests" could not be used on the command line, since it appears to means "run category db, except for category tests." The same limitation applies to characters that have special meaning for the shell you are using.

Examples

The following examples assume that the teamcity.dotnet.nunitlauncher property is set as system property on the Parameters page of the Build Configuration.

Run tests from an assembly:

Code Block

%teamcity.dotnet.nunitlauncher% v2.0 x64 NUnit-2.2.10 Assembly.dll

Run tests from an assembly with NUnit categories filter

Code Block

%teamcity.dotnet.nunitlauncher% v2.0 x64 NUnit-2.2.10 /category-include:C1 /category-exclude:C2 Assembly.dll

Run tests from assemblies:

Code Block

%teamcity.dotnet.nunitlauncher% v2.0 x64 NUnit-2.5.0 /addin:Addin1.dll;Addin2.dll Assembly.dll Assebly2.dll

...