Search code examples
teamcitymspec

TeamCity & MSpec with sln2008 runner?


I'm currently using the sln2008 runner. Is there a way to configure TeamCity to execute MSpec tests without switching to a NAnt or MSBuild runner?


Solution

  • I've never done it, but you could probably add a post build Exec task that just shelled out to mspec.exe. Just throw the code from my answer linked to above (How to integrate MSpec with MS Build?) in your specs csproj and add DependsOnTargets="RunSpecs" to your AfterBuild target:

      <Target Name="RunSpecs">
        <PropertyGroup>
          <MSpecCommand>
            lib\machine\specifications\Machine.Specifications.ConsoleRunner.exe $(AdditionalSettings) path\to\your\project\bin\Debug\Your.Project.Specs.dll path\to\your\other\project\bin\Debug\Your.Other.Project.dll 
          </MSpecCommand>
        </PropertyGroup>
        <Message Importance="high" Text="Running Specs with this command: $(MSpecCommand)"/>
        <Exec Command="$(MSpecCommand)" />
      </Target>
      <Target Name="AfterBuild" DependsOnTargets="RunSpecs">
      </Target>