Icon

You are viewing the documentation of TeamCity 9.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.
Comment: related to https://youtrack.jetbrains.com/issue/TW-50854

TeamCity provides its own NUnit tests launcher that can be used from command line. The tests are run according to the passed parameters and, if the process is run inside the TeamCity build agent environment, the results are reported to the TeamCity agent.

Info

Supported NUnit versions: 2.2.102.4.12.4.62.4.72.4.82.5.02.5.22.5.32.5.42.5.52.5.62.5.72.5.82.5.92.5.102.6.02.6.12.6.22.6.3. For NUnit 3.x, use the NUnit build runner since TeamCity 9.1.
It is possible to have several versions of NUnit installed on an agent machine and use any of them in a build.

Note
  • If you need to access the path to the TeamCity NUnit launcher from some process, you can add the %system.teamcity.dotnet.nunitlauncher% environment variable.
  • Values surrounded with "%" within custom scripts in the Commandline runner are treated as TeamCity references.

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-exclude:<list>

The list of categories separated by ';' (optional).

/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.

...

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

...