TeamCity Addin for NUnit
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.
To be able to review test results in TeamCity, do the following:
- In your build, set the path to the TeamCity Addin to the system property
teamcity.dotnet.nunitaddin
(for MSBuild it would beteamcity_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
)
Copy the
.dll
and.pdb
TeamCity addin files to the NUnit addin directory.
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
andbin/addins
folderspatch
NUnit-Console.exe.config
to include the addins to application probe paths. Add the following code into theconfig/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.