Как да интегрирам MSpec с MS Build?

Преди няколко дни гледах BDD screencast от Роб Конъри. Във видеото той показа как да използва MSpec, така че го изтеглих и си поиграх с частите. Това, което искам сега, е да интегрирам MSpec с MS Build, но не знам как... Използвам TFS team build като мой CI сървър - Можете ли да ми помогнете да интегрирам MSpec с MSBuild?

Благодаря!


person Pavel Nikolov    schedule 02.06.2009    source източник


Отговори (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
person Aaron Jensen    schedule 02.06.2009
comment
Имайте предвид, че когато правите това с NAnt, използвайте arg line=assembly1 assembly2, а не arg value (в противен случай ще получите хубава грешка, която е много неочевидна) - person Neal; 20.10.2009