You are viewing the documentation of TeamCity 8.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 9.x documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

Skip to end of metadata
Go to start of metadata

If you run NUnit tests via the NUnit console and want TeamCity to track the test results without having to launch the TeamCity test runner, the best solution is to use TeamCity Addin for NUnit. You can plug this addin into NUnit, and the tests will be automatically reported to the TeamCity server.

Alternatively, you can opt to use the XML Report Processing build feature, or manually configure reporting tests by means of service messages.


TeamCity NUnit Addin supports the following versions: 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.

To be able to review test results in TeamCity, do the following:

  1. In your build, set the path to the TeamCity Addin to the system property teamcity.dotnet.nunitaddin (for MSBuild it would be teamcity_dotnet_nunitaddin), and add the version of NUnit at the end of this path. For example:
    • For NUnit 2.4.X, use ${teamcity.dotnet.nunitaddin}-2.4.X.dll (for MSBuild: $(teamcity_dotnet_nunitaddin)-2.4.X.dll)
      Example for NUnit 2.4.7: NAnt: ${teamcity.dotnet.nunitaddin}-2.4.7.dll, MSBuild: $(teamcity_dotnet_nunitaddin)-2.4.7.dll
    • For NUnit 2.5.0 alpha 4, use ${teamcity.dotnet.nunitaddin}-2.5.0.dll (for MSBuild: $(teamcity_dotnet_nunitaddin)-2.5.0.dll)
  2. Copy the .dll and .pdb TeamCity addin files to the NUnit addin directory.

Although you can copy these files once, it is highly recommended to configure your builds so that the TeamCity addin files are copied to the NUnit addin directory for each build, because these files could be updated by TeamCity.

The following example shows how to use the NUnit console runner with the TeamCity Addin for NUnit 2.4.7 (on MSBuild):

Important Notes

NUnit 2.4.8 Issue
NUnit 2.4.8 has the following known issue: NUnit 2.4.8 runner tries to load an assembly according to the created AssemblyName object; however, the addins folder of NUnit 2.4.8 is not included in application probe paths. Thus NUnit 2.4.8 fails to load any addin in the console mode.
To solve the problem, we suggest you use any of the following workarounds:

  • copy the TeamCity addin assembly both to the NUnit bin and bin/addins folders
  • patch NUnit-Console.exe.config to include the addins to application probe paths. Add the following code into the config/runtime element:
    See original blog post on this issue http://nunit.com/blogs/?p=56

Environment variables
If you need to configure environment variables for NUnit explicitly, specify an environment variable with the value reference of %system.teamcity.dotnet.nunitaddin%.
See Configuring Build Parameters for details.

  • No labels