Unfolding TeamCity Addin for NUnit Secrets
In today’s episode of the NUnit mini-series we’d like to share some information on using TeamCity Addin for NUnit.
As we wrote in our previous post, to provide tests state tracking and on-the-fly reporting, TeamCity bundles NUnit and includes its own NUnit runners. These embedded runners suit most cases perfectly well but there can be situations when you:
- prefer to use particular NUnit instance (not TeamCity’s bundled) for your particular build configuration
- want to pass NUnit project file (
For cases like these you can use a recently implemented TeamCity Addin for NUnit available in TeamCity 4.0 EAP; the Addin supports the following versions of NUnit: 2.4.6, 2.4.7, 2.4.8 and 2.5.0 Alpha3.
How does it work?
TeamCity Addin for NUnit is embedded in the system by default and contains
.pdb files for each supported version of NUnit. For every build, the main part of a path to the TeamCity Addin is set to the build property and the environment variable of the same name:
To enable on-the-fly tests reporting, all you have to do is to add a task in your build for copying an appropriate Addin’s files to your NUnit’s addins directory. Type your NUnit version at the end of the TeamCity Addin path using the following syntax:
- For NAnt:
- For MSBuild:
In the above filenames, the <NUnit version> parameter can possess the following values: 2.4.6, 2.4.7, 2.4.8, and 2.5.0.
Please note that we recommend to copy TeamCity Addin for NUnit files every time you run the particular build.
The following example for MSBuild shows how to use NUnit console runner with TeamCity Addin for NUnit 2.4.7:
<PropertyGroup> <NUnit><i>Path_to_NUnit_console</i></NUnit> <NUnitAddinsDir><i>Path_to_NUnit_Addins _Dir</i></NUnitAddinsDir> </PropertyGroup> <ItemGroup> <NUnitAddinFiles Include="$(teamcity_dotnet_nunitaddin)-2.4.7.*" /> </ItemGroup> <Target Name="RunTests"> <Copy SourceFiles="@(NUnitAddinFiles)" DestinationFolder="$(NUnitAddinsDir)" /> <Exec Command="$(NUnit) $(NUnitFileName)" /> </Target>
Well, it’s again a time for a break. See you soon!
Subscribe to Blog updates
Thanks, we've got you!
How To Choose a CI/CD Tool: A Framework
In this blog post, we offer general guidelines for selecting an appropriate CI/CD solution and delve into how TeamCity fits into this framework.
Increase Your Productivity With TeamCity Documentation Examples for the Kotlin DSL
Take advantage of extensive Kotlin DSL documentation for TeamCity - now with examples! Read more about how it might increase your productivity in this blog post.
Monitor Your TeamCity Builds with Datadog CI Visibility
Datadog now offers deep, end-to-end visibility into your TeamCity builds with the new TeamCity integration for CI Pipeline Visibility.