Подтвердить что ты не робот

Как интегрировать MSpec с MS Build?

Несколько дней назад я смотрел BDD screencast от Rob Conery. В видеоролике он показал, как использовать MSpec, поэтому я загрузил его и сыграл с битами. Теперь я хочу интегрировать MSpec с MS Build, но я не знаю, как... Я использую сборку TFS как мой CI-сервер. Можете ли вы помочь мне интегрировать MSpec с помощью MSBuild?

Спасибо!

4b9b3361

Ответ 1

В настоящий момент самый простой способ - просто выполнить 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>

Изменить: Обратите внимание на дополнительные настройки, вы можете позвонить в цель следующим образом:

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

Если вы передаете -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