Pepper
Pepper

Reputation: 213

Generating SpecFlow Reports with the CakeBuild Specflow plugin possible?

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

enter image description here

Upvotes: 1

Views: 583

Answers (2)

bjorkstromm
bjorkstromm

Reputation: 423

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.

Upvotes: 2

Andreas Willich
Andreas Willich

Reputation: 5835

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.

Upvotes: 2

Related Questions