diff --git a/Tests/ReportingTests/NUnitExecutionReport.feature b/Tests/ReportingTests/NUnitExecutionReport.feature new file mode 100644 index 000000000..6aab265a0 --- /dev/null +++ b/Tests/ReportingTests/NUnitExecutionReport.feature @@ -0,0 +1,79 @@ +Feature: Generating HTML report from NUnit execution result + In order to present the test results in a nice form + As a test manager + I want to be able to generate an HTML report from the NUnit execution result + +Scenario: Summary is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ + Summary + Features Success rate Scenarios Success Failed Pending Ignored + 2 features 40% 5 2 1 1 1 + """ + + +Scenario: Feature summary is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ + Feature Summary + Feature Success rate Scenarios Success Failed Pending Ignored + Feature with failing scenarios 0% 3 0 1 1 1 + Feature with successful scenarios 100% 2 2 0 0 0 + """ + + +Scenario: Successful test output is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ + Given I have a precondition that is successful + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs("successful") (0,0s) + When I do something that works + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs("works") (0,0s) + Then I have a postcondition that is successful + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs("successful") (0,0s) + """ + + +Scenario: Pending test output is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ + Given I have a pending precondition + -> No matching step definition found for the step. Use the following code to create one: + [Binding] + public class StepDefinitions + { + [Given(@"I have a pending precondition")] + public void GivenIHaveAPendingPrecondition() + { + ScenarioContext.Current.Pending(); + } + } + """ + + +Scenario: Failing test output is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ + Given I have a precondition that is failing + -> error: simulated failure + """ + + +Scenario: Failing test exception is included in the HTML result + Given there are NUuit test execution results for the ReportingTest.SampleProject project + When I generate SpecFlow NUnit execution report + Then a report generated containing + """ +simulated failure +at ReportingTest.SampleProject.StepDefinitions.GivenIHaveAPreconditionThatIs(String result) in + """ diff --git a/Tests/ReportingTests/NUnitExecutionReport.feature.cs b/Tests/ReportingTests/NUnitExecutionReport.feature.cs new file mode 100644 index 000000000..6ee6202fd --- /dev/null +++ b/Tests/ReportingTests/NUnitExecutionReport.feature.cs @@ -0,0 +1,190 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by SpecFlow (http://www.specflow.org/). +// SpecFlow Version:1.3.2.0 +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +#region Designer generated code +namespace ReportingTests +{ + using TechTalk.SpecFlow; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [NUnit.Framework.TestFixtureAttribute()] + [NUnit.Framework.DescriptionAttribute("Generating HTML report from NUnit execution result")] + public partial class GeneratingHTMLReportFromNUnitExecutionResultFeature + { + + private static TechTalk.SpecFlow.ITestRunner testRunner; + +#line 1 "NUnitExecutionReport.feature" +#line hidden + + [NUnit.Framework.TestFixtureSetUpAttribute()] + public virtual void FeatureSetup() + { + testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Generating HTML report from NUnit execution result", "In order to present the test results in a nice form\r\nAs a test manager\r\nI want to" + + " be able to generate an HTML report from the NUnit execution result", ((string[])(null))); + testRunner.OnFeatureStart(featureInfo); + } + + [NUnit.Framework.TestFixtureTearDownAttribute()] + public virtual void FeatureTearDown() + { + testRunner.OnFeatureEnd(); + testRunner = null; + } + + public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) + { + testRunner.OnScenarioStart(scenarioInfo); + } + + [NUnit.Framework.TearDownAttribute()] + public virtual void ScenarioTearDown() + { + testRunner.OnScenarioEnd(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Summary is included in the HTML result")] + public virtual void SummaryIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Summary is included in the HTML result", ((string[])(null))); +#line 6 +this.ScenarioSetup(scenarioInfo); +#line 7 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 8 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 9 +testRunner.Then("a report generated containing", "\tSummary \r\n\tFeatures\tSuccess rate\tScenarios\tSuccess\t\tFailed\tPending\t\tIgnored \r\n\t2" + + " features\t40%\t\t\t\t5\t\t\t2\t\t\t1\t\t1\t\t\t1 ", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Feature summary is included in the HTML result")] + public virtual void FeatureSummaryIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Feature summary is included in the HTML result", ((string[])(null))); +#line 17 +this.ScenarioSetup(scenarioInfo); +#line 18 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 19 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 20 +testRunner.Then("a report generated containing", "\tFeature Summary\r\n\tFeature\t\t\t\t\t\t\t\tSuccess rate\tScenarios\tSuccess\t\tFailed\tPending\t" + + "\tIgnored\t\t\r\n\tFeature with failing scenarios\t\t0%\t\t\t\t3\t\t\t0\t\t\t1\t\t1\t\t\t1\r\n\tFeature wi" + + "th successful scenarios\t100%\t\t\t2\t\t\t2\t\t\t0\t\t0\t\t\t0", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Successful test output is included in the HTML result")] + public virtual void SuccessfulTestOutputIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Successful test output is included in the HTML result", ((string[])(null))); +#line 29 +this.ScenarioSetup(scenarioInfo); +#line 30 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 31 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 32 +testRunner.Then("a report generated containing", @" Given I have a precondition that is successful + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs(""successful"") (0,0s) + When I do something that works + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs(""works"") (0,0s) + Then I have a postcondition that is successful + -> done: StepDefinitions.GivenIHaveAPreconditionThatIs(""successful"") (0,0s)", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Pending test output is included in the HTML result")] + public virtual void PendingTestOutputIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Pending test output is included in the HTML result", ((string[])(null))); +#line 43 +this.ScenarioSetup(scenarioInfo); +#line 44 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 45 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 46 +testRunner.Then("a report generated containing", @" Given I have a pending precondition + -> No matching step definition found for the step. Use the following code to create one: + [Binding] + public class StepDefinitions + { + [Given(@""I have a pending precondition"")] + public void GivenIHaveAPendingPrecondition() + { + ScenarioContext.Current.Pending(); + } + }", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Failing test output is included in the HTML result")] + public virtual void FailingTestOutputIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Failing test output is included in the HTML result", ((string[])(null))); +#line 62 +this.ScenarioSetup(scenarioInfo); +#line 63 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 64 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 65 +testRunner.Then("a report generated containing", "\tGiven I have a precondition that is failing\r\n\t-> error: simulated failure", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Failing test exception is included in the HTML result")] + public virtual void FailingTestExceptionIsIncludedInTheHTMLResult() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Failing test exception is included in the HTML result", ((string[])(null))); +#line 72 +this.ScenarioSetup(scenarioInfo); +#line 73 +testRunner.Given("there are NUuit test execution results for the ReportingTest.SampleProject projec" + + "t"); +#line 74 +testRunner.When("I generate SpecFlow NUnit execution report"); +#line hidden +#line 75 +testRunner.Then("a report generated containing", "simulated failure\r\nat ReportingTest.SampleProject.StepDefinitions.GivenIHaveAPrec" + + "onditionThatIs(String result) in ", ((TechTalk.SpecFlow.Table)(null))); +#line hidden + testRunner.CollectScenarioErrors(); + } + } +} +#endregion diff --git a/Tests/ReportingTests/ReportingTests.csproj b/Tests/ReportingTests/ReportingTests.csproj index 6fdfe7291..4b9e0dc4a 100644 --- a/Tests/ReportingTests/ReportingTests.csproj +++ b/Tests/ReportingTests/ReportingTests.csproj @@ -54,6 +54,11 @@ True CustomXsltTemplate.feature + + True + True + NUnitExecutionReport.feature + @@ -81,6 +86,10 @@ SpecFlowSingleFileGenerator CustomXsltTemplate.feature.cs + + SpecFlowSingleFileGenerator + NUnitExecutionReport.feature.cs +