Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity and running NUnit tests

Tags:

teamcity

nunit

In TeamCity, i need to state exact locations of assemblies that contain NUnit tests to be executed.

Is there an option to state a .SLN file so it will look up these test projects dynamically?

like image 326
lysergic-acid Avatar asked Jun 14 '11 08:06

lysergic-acid


2 Answers

You can use wildcard expressions in the Run tests from box:

Source\\**\bin\\**\*Tests.dll

The above would run tests from any assembly under any bin folder under the Source folder which contains 'Tests' at the end of the assembly name.

like image 134
devdigital Avatar answered Nov 24 '22 00:11

devdigital


Depending on whether you're using MSBuild or NAnt, you can add an entry to your build script like this:

<ItemGroup>
  <TestAssemblies Include="tests\\test*.dll"/>
  <TestAssemblies Include="tests.lib\\test*.dll"/>
</ItemGroup>

<Target Name="runTests">
  <Exec Command="$(teamcity_dotnet_nunitlauncher) v2.0 x86 NUnit-2.5.0 %(TestAssemblies)" />
</Target>

In the example above, the two TestAssemblies lines point to your assemblies.

You can read more about this here: http://blogs.jetbrains.com/teamcity/2008/09/24/using-teamcity-nunit-launcher/

like image 21
christofr Avatar answered Nov 23 '22 23:11

christofr