TeamCity 9.0 Help

NUnit

NUnit build runner is intended to run NUnit tests right on the TeamCity server. However, there are other ways to report NUnit tests results to TeamCity, please refer to the NUnit Support page for the details.

NUnit 3 Requirements

Installing NUnit

To use the TeamCity NUnit build runner, you need to install NUnit NuGet package on TeamCity agents first.

Installing Extensions

Starting from version 3.2.0, NUnit requires the NUnit.Extension.NUnitProjectLoaderextension to be installed on the TeamCity agent. Starting from version 3.4.1, NUnit requires the NUnit.Extension.TeamCityEventListenerextension to be installed on the TeamCity agent.

The extensions can be installed in bulk using the NUnit Console Version 3 NuGet package or as separate packages, NUnit.Extension.TeamCityEventListener and NUnit.Extension.NUnitProjectLoader. If you are experiencing build problems or issues displaying test results with NUnit versions listed above, make sure the extensions are present on the TeamCity build agent.

NUnit Test Settings

NUnit runner

Select the NUnit version to be used to run the tests. The number of settings available will vary depending on the selected version.

Path to NUnit console tool:

Available if NUnit 3.0 is selected. Specify the path to NUnit console tool:

prior to TeamCity 9.1.4 specify the directory containing the console executable file , since 9.1.4 specify the path to the console executable file including the file name.

Path to application configuration file

Available if NUnit 3.0 is selected.Specifу the path to the application configuration file to be used when running tests. The path is absolute or relative to the checkout directory.

Additional command line parameters

Available if NUnit 3.0 is selected. Enter additional command line parameters to pass to nunit-console.exe

.NET Runtime

From the Platform drop-down, select the desired execution mode on a x64 machine. Supported values are: Auto (MSIL), x86 and x64. From the Version drop-down, select the desired .NET Framework version. Supported values are: v2.0, v4.0; and <auto>, available if NUnit 3.0 is selected. For NUnit 3.0, if <auto> is selected, tests will run under the framework they are compiled with.

Run tests from

Specify the .NET assemblies, where the NUnit tests to be run are stored. Multiple entries are comma-separated; usage of MSBuild wildcards is enabled. The paths are absolute or relative to the checkout directory. In the following example, TeamCity will search for the tests assemblies in all project directories and run these tests.

**\*.dll

Do not run tests from

Specify .NET assemblies that should be excluded from the list of assemblies to test. Multiple entries are comma-separated; usage of MSBuild wildcards is enabled. The paths are absolute or relative to the checkout directory. In the following example, TeamCity will omit tests specified in this directory.

**\obj\**\*.dll

Include categories

Specify NUnit categories of tests to be run. Multiple entries are comma-separated. Category expressions are supported here as well; commas, semicolons, and new-lines are treated as global or operations (prior to the expression parsing).

E xclude categories

Specify NUnit categories to be excluded from the tests to be run. Multiple entries are comma-separated. Category expressions are supported here as well; commas, semicolons, and new-lines are treated as global or operations (prior to the expression parsing).

Run process per assembly

Available for versions only (. Select this option if you want to run each assembly in a new process.

Reduce test failure feedback time

Use this option to instruct TeamCity to run some tests before others. Currently not supported for NUnit 3.0.

Code Coverage

To learn about configuring code coverage options, please refer to the Configuring .NET Code Coverage page.

For NUnit 3.x, only JetBrains dotCover is supported as a coverage tool.

Administrator's Guide: Configuring Unit Testing and Code Coverage | NUnit Support | Getting Started with NUnit

Last modified: 20 April 2023