10

几天前,我观看了Rob Conery的BDD 截屏视频。在视频中,他展示了如何使用MSpec,所以我下载了它并使用了这些位。我现在想要将MSpec与 MS Build 集成,但我不知道如何......我使用 TFS 团队构建作为我的 CI 服务器 - 你能帮我将MSpec与 MSBuild 集成吗?

谢谢!

4

1 回答 1

7

目前最简单的方法是执行它。

 <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 &quot;web&quot; --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
于 2009-06-02T15:25:24.197 回答