可以使用CakeBuild Specflow插件生成SpecFlow报告吗?

时间:2017-07-05 15:13:34

标签: specflow cakebuild

是否可以使用CakeBuild Specflow插件(CakeBuild SpecFlow)生成SpecFlow报告?

enter image description here

2 个答案:

答案 0 :(得分:2)

这是SpecFlow + Runner报告(http://specflow.org/plus/runner/)。 对于CakeBuild,我建议您通过VSTest和SpecFlow + Runner测试适配器执行测试。

因此,请使用VSTest功能(http://cakebuild.net/dsl/vstest/)并将TestAdapterPath配置为本地NuGet包文件夹。

所以你得到了这个报告。

答案 1 :(得分:1)

是的,可以使用Cake构建创建测试执行报告。这是使用NUnit3作为测试运行器的快速示例(其他支持的运行程序是MSTest,XUnit和NUnit2)。

#tool "nuget:?package=NUnit.ConsoleRunner"
#tool "nuget:?package=SpecFlow"

var target = Argument("target", "Default");

Task("Default")
    .Does(() =>
{
    SpecFlowTestExecutionReport(tool => {
        tool.NUnit3("/path/to/your/tests.dll",
            new NUnit3Settings {
                Results = "/path/to/testresults.xml",
                ResultFormat = "nunit2",
                Labels = NUnit3Labels.All,
                OutputFile = "/path/to/testoutput.txt"
            });
        }, "/path/to/your/test/project.csproj",
        new SpecFlowTestExecutionReportSettings {
            Out = "/path/to/specflow/execution/report.html",
            XsltFile = "/path/to/optional/transform/file.xslt"
        });
});

RunTarget(target);

但是作为Andreas Willich answered,您发布的示例输出是SpecFlow + Runner报告。老实说,我不能说SpecFlow别名是否与该跑步者兼容。它仅使用默认的SpecFlow运行器进行测试。