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.NUnitProjectLoader
extension to be installed on the TeamCity agent. Starting from version 3.4.1, NUnit requires the NUnit.Extension.TeamCityEventListener
extension 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
Select the NUnit version to be used to run the tests. The number of settings available will vary depending on the selected version. | |
---|---|
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. | |
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. | |
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: |
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