2009-06-02 71 views

回答

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 
+0

请注意,当您使用NAnt进行此操作时,请使用arg line =“assembly1 assembly2”而不是arg值(否则您会得到一个非常不明显的错误) – Neal 2009-10-20 02:00:10