如何将MSpec与MS Build整合?
问题描述:
前几天我看了一个BDD screencast由Rob Conery。在视频中他展示了如何使用MSpec,所以我下载了它并使用了这些位。我现在想要的是将MSpec与MS Build集成,但我不知道如何......我使用TFS团队构建作为我的CI服务器 - 您能帮我将MSpec与MSBuild集成吗?如何将MSpec与MS Build整合?
谢谢!
答
目前最简单的方法就是执行它。
<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>
编辑:通知其他设置,你可以调用目标是这样的:
<MSBuild Projects="yourmsbuild.msbuild" Targets="RunSpecs" Properties="AdditionalSettings=-s -t -i "web" --html Specs\Specs.html"/>
如果传递--teamcity作为参数,它输出的TeamCity特定的日志数据,这样的TeamCity将跟踪你的测试。
Machine.Specifications
Copyright (C) 2007, 2008
Usage: mspec-runner.exe [options] <assemblies>
Options:
-i, --include Executes all specifications in contexts with these comma delimited tags. Ex. -i "foo,bar,foo_bar"
-x, --exclude Exclude specifications in contexts with these comma delimited tags. Ex. -x "foo,bar,foo_bar"
-t, --timeinfo Shows time-related information in HTML output
-s, --silent Suppress console output
--teamcity Reporting for TeamCity CI integration.
--html <PATH> Outputs an HTML file(s) to path, one-per-assembly w/ index.html (if directory, otherwise all are in
one file)
-h, --help Shows this help message
请注意,当您使用NAnt进行此操作时,请使用arg line =“assembly1 assembly2”而不是arg值(否则您会得到一个非常不明显的错误) – Neal 2009-10-20 02:00:10