2009-06-02 40 views
10

Vài ngày trước, tôi đã xem một số BDD screencast bởi Rob Conery. Trong video ông đã cho thấy làm thế nào để sử dụng MSpec, vì vậy tôi đã tải về và chơi với các bit. Những gì tôi muốn bây giờ là để tích hợp MSpec với MS Build, nhưng tôi không biết làm thế nào ... Tôi sử dụng TFS đội xây dựng như máy chủ CI của tôi - Bạn có thể giúp tôi để tích hợp MSpec với MSBuild?Làm thế nào để tích hợp MSpec với MS Build?

Cảm ơn!

Trả lời

7

Hiện tại, cách dễ nhất là chỉ cần Exec.

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

Edit: Thông báo Cài đặt bổ sung, bạn có thể gọi vào mục tiêu như thế này:

<MSBuild Projects="yourmsbuild.msbuild" Targets="RunSpecs" Properties="AdditionalSettings=-s -t -i &quot;web&quot; --html Specs\Specs.html"/> 

Nếu bạn vượt qua --teamcity như một tham số nó ra dữ liệu log cụ thể TeamCity để TeamCity sẽ theo dõi các bài kiểm tra của bạn .

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

Lưu ý rằng khi bạn đang làm điều này với việc sử dụng không sử dụng arg line = "assembly1 assembly2" không arg giá trị (nếu không bạn sẽ nhận được lỗi tốt không rõ ràng) – Neal

Các vấn đề liên quan