NUnit Support in TeamCity
There are two most common methods to set up NUnit tests reporting in TeamCity:
Besides, you can try alternative approaches or run tests in any other runner (like PowerShell or Command Line) with the TeamCity VSTest Adapter.
This article describes the specifics of the NUnit support in TeamCity and the alternative approaches to establishing it.
Supported NUnit Versions
The following NUnit versions are supported: 2.2.10, 2.4.1, 2.4.6, 2.4.7, 2.4.8, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.5.10, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 3.0.
It is possible to have several versions of NUnit installed on an agent machine and use any of them in a build.
warning
NUnit version 3.4.0 is not supported by the NUnit build runner due to a problem in NUnit. Only version 3.4.0 was affected, other NUnit 3.x versions work fine with TeamCity.
NUnit Framework Compatibility
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+ and .NET 5+ | |
---|---|---|---|
NUnit runner
| |||
.NET runner
| |||
VSTest adapter in other runners |
Alternative Approaches
If using the NUnit or .NET build runners is inapplicable, TeamCity provides the following ways to configure NUnit tests reporting in TeamCity:
The standard NUnit for NAnt Build Runner.
The NUnit Test Launcher that can be configured in the MSBuild build script or launched from the command line.
TeamCity Add-in 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, Importing XML Reports.Configuring test reports 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 Add-in 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.
Thanks for your feedback!