Generating SpecFlow Reports with the CakeBuild Specflow plugin possible?

南楼画角 提交于 2019-12-11 04:50:13

问题


Is it possible to generate SpecFlow Reports with the CakeBuild Specflow plugin (CakeBuild SpecFlow) ?


回答1:


Yes it's possible to create Test Execution report with Cake build. Here's a quick example using NUnit3 as test runner (other supported runners are MSTest, XUnit and 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);

But as Andreas Willich answered, the example output you posted is a SpecFlow+Runner report. Honestly I can't say if the SpecFlow aliases are compatible with that runner. It's only tested with the default SpecFlow runner.




回答2:


This is a SpecFlow+Runner report (http://specflow.org/plus/runner/). For CakeBuild I suggest you execute the tests via VSTest and the SpecFlow+Runner test adapter.

So use the VSTest functionality (http://cakebuild.net/dsl/vstest/) and configure the TestAdapterPath to the local NuGet package folder.

So you get this report generated.



来源:https://stackoverflow.com/questions/44930074/generating-specflow-reports-with-the-cakebuild-specflow-plugin-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!