我有一个项目正在使用SpecFlow,NUnit和Coypu对Web应用程序进行验收测试.我在构建服务器上通过Jenkins建立了项目.Jenkins调用psake脚本在specs项目上运行msbuild,然后脚本调用nunit-console来运行specs/tests,然后我想从SpecFlow生成一个报告.
Framework "4.0"
task Default -depends RunSpecs
task BuildSpecs {
$env:EnableNuGetPackageRestore = "true"
msbuild /t:Rebuild ReturnsPortal.Specs.csproj
}
task RunSpecs -depends BuildSpecs {
exec { & "C:\path\to\NUnit 2.5.9\bin\net-2.0\nunit-console-x86.exe" /labels /out=TestResult.txt /xml=TestResult.xml .\bin\Debug\TheWebApp.Specs.dll }
exec { & "C:\path\to\SpecFlow\1.8.1\specflow.exe" nunitexecutionreport TheWebApp.Specs.csproj /out:SpecResult.html }
}
Run Code Online (Sandbox Code Playgroud)
最后一次对specflow.exe的exec调用失败,但是:
元素<UsingTask>下的元素<ParameterGroup>无法识别.C:\ Program Files(x86)\ Jenkins\jobs\TheWebApp\workspace\Web\Sites\TheWebApp.nuget \nuget.targets
一些谷歌搜索暗示可能是使用msbuild版本的问题(例如这里,这里).但是Framework "4.0"我的psake脚本中,Specs项目的目标是.NET Framework 4.0,它在构建步骤中构建得很好,所以我不确定为什么specflow似乎使用了早期版本的msbuild.或者也许是其他地方的问题?