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?
Asked
Active
Viewed 509 times
2 Answers
1
You may use msbuild runner. Please see How to integrate MSpec with MS Build? for description on how to integrate msbuild and mspec

Community
- 1
- 1

Eugene Petrenko
- 4,874
- 27
- 36
-
Thanks Eugene. I came across that answer as well. I was hoping to do it using the sln2008 runner. – Bob Banks Oct 19 '09 at 14:05
1
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>

Community
- 1
- 1

Aaron Jensen
- 6,030
- 1
- 30
- 40
-
Interesting. I hadn't thought of that. Thanks Aaron! I'll give it a shot. – Bob Banks Dec 23 '09 at 13:18
-
No problem, let me know if it works out. That said, unless you have a very good reason for sticking to the sln2008 runner I'd toss that goal aside and use msbuild or rake (I *much* prefer rake). – Aaron Jensen Dec 27 '09 at 18:49
-
What would be the advantage of using msbuild or rake and not the sln2008 runner? – DavidS Apr 06 '11 at 12:35
-
@DavidS simply the amount of flexibility it gives you and how easy it is to get the build to do exactly what you want. The above snippet I guessed at would only be a few lines in rake. For msbuild it's just nice to have a root msbuild so you can attach tasks that are global to the entire repository (such as generating an AssemblyInfo.cs before any csproj builds). I'd still prefer rake. – Aaron Jensen Apr 27 '11 at 03:10