本文介绍了尝试生成测试执行报告时,specflow失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用SpecFlow,NUnit和Coypu在Web应用程序上进行验收测试的项目.我已经通过Jenkins在构建服务器上构建了项目. Jenkins调用了一个psake脚本,该脚本在specs项目上运行msbuild,然后该脚本调用nunit-console来运行spec/test,然后我要从SpecFlow生成报告.

I've got a project that's using SpecFlow, NUnit and Coypu to do acceptance tests on a web application. I've got the project building OK via Jenkins on a build server. Jenkins calls a psake script which runs msbuild on the specs project, then the script calls nunit-console to run the specs/tests, and then I want to generate a report from 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 }
}

最后一次对specflow.exe的exec调用失败,显示为:

That last exec call to specflow.exe fails though, with:

有点谷歌搜索暗示可能是所使用的msbuild版本存在问题(例如,此处).但是我的psake脚本中有Framework "4.0",并且Specs项目的目标是.NET Framework 4.0,并且在构建步骤中构建良好,因此我不确定为什么specflow似乎正在使用早期版本的msbuild.或者也许是其他地方的问题?

A bit of googling hints that maybe it's a problem with the msbuild version being used (e.g. here, here). But I have Framework "4.0" in my psake script, and the Specs project is targeting .NET Framework 4.0, and it builds fine in the build step, so I'm not sure why specflow seems to be using an earlier version of msbuild. Or is maybe the problem somewhere else?

推荐答案

这是我的答案,来自 SpecFlow Wiki :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0.30319" />
    </startup>
</configuration>

这篇关于尝试生成测试执行报告时,specflow失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 13:08