【问题标题】:How to integrate MSpec with MS Build?如何将 MSpec 与 MS Build 集成?
【发布时间】:2010-10-30 14:46:18
【问题描述】:

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

谢谢!

【问题讨论】:

    标签: .net msbuild continuous-integration bdd mspec


    【解决方案1】:

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

     <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
    

    【讨论】:

    • 请注意,当您使用 NAnt 执行此操作时,请使用 arg line="assembly1 assembly2" 而不是 arg 值(否则您会得到一个非常不明显的错误)
    猜你喜欢
    • 2011-08-11
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多