TeamCity with Gallio and MSpec

Has anyone been able to use MSpec with the provided Gallio plugin or somehow been able to use nUnit to run MSpec tests? My goal is to integrate the output of the tests with TeamCity.

Currently, TeamCity supports Gallio and nUnit, however the Gallio support is so new I haven't been able to find any documentation on it. I also don't think there is any nUnit extension for MSpec.

4 comments
Comment actions Permalink

Mike, I saw your post to Gallio-dev group. I think the right way is to try Gallio to run your MSpec tests.
First of all, please make you tests running under a build script (MSBuild or NAnt) from console.

To enable test logging into TeamCity, please enable TeamCity Gallio extension, that is bundled to Gallio.
Jeff gave you a good documentation for that. If you are still having an issue with Gallio and TeamCity, please
let me know!

Thanks!

0
Comment actions Permalink

I use MbUnit with Gallio on TeamCity. You have to use a custom MSBuild script to coordinate the tests. I don't remember where I found this, or I'd give credit, but it works:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This is needed by MSBuild to locate the Gallio task -->
<UsingTask AssemblyFile="..\..\..\Assemblies\Gallio\bin\Gallio.MSBuildTasks.dll" TaskName="Gallio" />
<!-- Specify the tests assemblies -->
<ItemGroup>
  <TestAssemblies Include="Servicing.Tests\bin\Debug\Servicing.Tests.dll" />
</ItemGroup>
<Target Name="RunTests">
  <Gallio IgnoreFailures="false" Assemblies="@(TestAssemblies)" RunnerExtensions="TeamCityExtension,Gallio.TeamCityIntegration">
   <!-- This tells MSBuild to store the output value of the task's ExitCode property into the project's ExitCode property -->
   <Output TaskParameter="ExitCode" PropertyName="ExitCode"/>
  </Gallio>
  <Error Text="Tests execution failed" Condition="'$(ExitCode)' != 0" />
</Target>
<Target Name="RebuildSolution">
  <Message Text="Starting to Build"/>
  <MSBuild Projects="Servicing.sln" Properties="Configuration=Debug" Targets="Rebuild" />
</Target>
</Project>

You need to have your Gallio.MSBuildTasks.dll checked into source control so you can reference it in this build script (with correct ..\..\ notation from your working directory)

You then need to specify the assemblies again using the correct \..\..\ navigation to the dlls with your tests.

The next part is to define a new target to run the tests, here it's called RunTests. Then another to actually kick off building of your project, here it's called RebuildSolution.


The final part is to configure your Team City Build Runner to run those two targets. Set it to use MSBuild. Set the build script to navigate to the one above. Then for your targets, put: RebuildSolution RunTests. This will first execute the RebuildSolution target, then the RunTests target.


Hopefully that helps,

Dan Lash

0
Comment actions Permalink

Actually, I found out that the latest head of MSpec has a MSpec console test runner with support for TeamCity .  One only has to use the --teamcity argument and it outputs formatting that TeamCity understands.

Mike

0
Comment actions Permalink

Mind posting how you integrate it?

0

Please sign in to leave a comment.