Howto setup TeamCity NUnit Runner with AutoFixture.NUnit2

In a previous post I explained how setup AutoFixture.NUnit2 to work with a few 3rd party applications, to complete the AutoFixture.NUnit2 story we need to be able to configure TeamCity for Continuous integration according to Teamcity documentations there are a few ways to do this, but only way I have been successful so far was to configure msbuild script to run nunit-console.exe

Example of msbuild script to copy Teamcity NUnit Addin and AutoFixture.NUnit2.Addins.dll

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="" DefaultTargets="CompleteBuild" ToolsVersion="4.0">

    	<NUnitAddinFiles Include="$(teamcity_dotnet_nunitaddin)-2.6.2.*" />
    	<NUnitAddinFiles Include="packages\AutoFixture.NUnit2.3.9.0\lib\net40\Ploeh.AutoFixture.NUnit2.Addins.dll" />

    <Target Name="RunTests">
    	<MakeDir Directories="$(NUnitHome)\addins" />
	<Copy SourceFiles="@(NUnitAddinFiles)" DestinationFolder="$(NUnitHome)\addins" />
	<Exec Command="$(NUnitHome)\nunit-console.exe $(TestAssembly)" />

    <Target Name="CompleteBuild" DependsOnTargets="RunTests" />

Howto guide for AutoFixture.NUnit2

With the release of AutoFixture.NUnit2 earlier today, here is some guidance howto get it working

NUnit Documentation: Addin Identification, Loading and Installation

NUnit examines all assemblies in the bin/addins directory, looking for public classes with the NUnitAddinAttribute and implementing the IAddin interface. It loads all those it finds as Addins.

After package install you need to copy packages\AutoFixture.NUnit2.3.9.0\lib\net40\Ploeh.AutoFixture.NUnit2.Addins.dll to bin\addins folder

But where exactly is bin/addins located. The short answer is where is the nunit.exe or nunit-console.exe located

Here is some default locations

  • NUnit2.6.2 -> C:\Program Files (x86)\NUnit 2.6.2\bin\addins
  • R# 8 -> C:\Program Files (x86)\JetBrains\ReSharper\v8.0\Bin\addins
  • TestDriven.Net -> C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.6\addins

Mark Seemann better explains how to use AutoDataAttribute here:

NUnit example

[Test, AutoData]
public void IntroductoryTest(
    int expectedNumber, MyClass sut)
    int result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);