public string ToPlainText(Scenario scenario) { var sb = new StringBuilder(); sb.AppendLine("Scenario: " + scenario.Title + " " + GetResultLabel(scenario)); if (scenario.Given.Steps.Any()) { sb.AppendLine(ToPlainText(TechTalk.SpecFlow.ScenarioBlock.Given, scenario.Given)); } if (scenario.When.Steps.Any()) { sb.AppendLine(ToPlainText(TechTalk.SpecFlow.ScenarioBlock.When, scenario.When)); } if (scenario.Then.Steps.Any()) { sb.AppendLine(ToPlainText(TechTalk.SpecFlow.ScenarioBlock.Then, scenario.Then)); } return sb.ToString(); }
internal static void BeforeScenario() { var starttime = CurrentRunTime; foreach (var reporter in reporters) { var scenario = new Scenario { Tags = new List<string>(ScenarioContext.Current.ScenarioInfo.Tags), Given = new ScenarioBlock {Steps = new List<Step>()}, When = new ScenarioBlock {Steps = new List<Step>()}, Then = new ScenarioBlock {Steps = new List<Step>()}, StartTime = starttime, Title = ScenarioContext.Current.ScenarioInfo.Title }; reporter.CurrentFeature.Scenarios.Add(scenario); reporter.CurrentScenario = scenario; OnStartedScenario(reporter); } }