NUnit Support
There are two most common methods to set up NUnit tests reporting in TeamCity:
Besides that, you can try alternative approaches or run tests in any other runner (like PowerShell or Command Line) with the TeamCity VSTest Adapter.
Framework Compatibility
The NUnit build runner supports only .NET Framework. To run tests for .NET Core projects (and .NET Framework projects version 4.0 or later), use the .NET CLI (dotnet) build runner with the test
command instead.
The following table represents the compatibility of TeamCity runners with the .NET implementations:
.NET Framework 1, 1.1, 2, 3.5 | .NET Framework 4+ | .NET Core 1+ | |
---|---|---|---|
NUnit runner
| |||
.NET CLI runner
| |||
VSTest adapter in other runners |
Alternative Approaches
If using NUnit build runner is inapplicable, TeamCity provides the following ways to configure NUnit tests reporting in TeamCity:
TeamCity supports the standard NUnit for NAnt Build Runner.
TeamCity provides the NUnit for MSBuild and supports the NUnit for MSBuild from MSBuild Community tasks.
TeamCity provides its own NUnit Test Launcher that can be configured in the MSBuild build script or launched from the command line.
TeamCity Addin for NUnit is available to turn on reporting on the NUnit level without build procedure modifications.
The bundled XML Test Reporting plugin allows importing any XML report to TeamCity. In this case it is not always possible to track results on the fly.
You can add the XML Report Processing build feature to your build configuration, or use the following service message:##teamcity[importData type='sometype' path='<path to the xml file>']
. Learn more: XML Report Processing, Build Script Interaction with TeamCity.TeamCity allows configuring tests reporting manually via service messages.
Feature Comparison for Alternative Approaches
Approach | Real-time Reporting | Execution in CLI-based runners | Tests Reordering | Implicit TeamCity .NET Coverage |
---|---|---|---|---|
<nunit2> NAnt task | / * | |||
<NUnit> MSBuild task | / * | |||
<NUnitTeamCity> MSBuild task | / * | |||
TeamCity Addin for NUnit | ||||
TeamCity NUnit Test Launcher | ||||
XML Reporting Plugin | N/A | N/A |
* TeamCity-provided tasks may have different syntax/behavior. Some workarounds may be required to run the script without TeamCity.
In addition to the common test reporting features, TeamCity allows running NUnit tests under the x86 process on the x64 machine by introducing an explicit specification of the platform and runtime environment versions. You can define whether to use .NET Framework 1.1, 2.0 or 4.0 started under an MSIL, x64 or x86 platform.