public ReportElements.StepDefinitionReport GenerateReport() { report = new ReportElements.StepDefinitionReport(); report.ProjectName = specFlowProject.ProjectSettings.ProjectName; report.GeneratedAt = DateTime.Now.ToString("g", CultureInfo.InvariantCulture); report.ShowBindingsWithoutInsance = ReportParameters.ShowBindingsWithoutInsance; stepDefByBinding = new Dictionary<BindingInfo, StepDefinition>(); bindingByStepDef = new Dictionary<StepDefinition, BindingInfo>(); foreach (var bindingInfo in bindings) { var stepDefinition = new StepDefinition(); stepDefinition.Binding = new Binding { MethodReference = bindingInfo.MethodReference }; stepDefinition.Type = bindingInfo.BindingType; stepDefByBinding.Add(bindingInfo, stepDefinition); bindingByStepDef.Add(stepDefinition, bindingInfo); report.StepDefinitions.Add(stepDefinition); } foreach (var feature in parsedFeatures) { var featureRef = new FeatureRef { FilePath = feature.SourceFile, Name = feature.Title }; if (feature.Background != null) { var scenarioRef = new ScenarioRef { Name = "Background" }; AddStepInstances(featureRef, scenarioRef, feature.Background.Steps, false); } foreach (var scenario in feature.Scenarios) { var scenarioRef = new ScenarioRef { Name = scenario.Title, SourceFileLine = scenario.FilePosition == null ? -1 : scenario.FilePosition.Line }; if (scenario is ScenarioOutline) { ScenarioSteps firstExampleSteps = CreateFirstExampleScenarioSteps((ScenarioOutline) scenario); AddStepInstances(featureRef, scenarioRef, firstExampleSteps, true); } else { AddStepInstances(featureRef, scenarioRef, scenario.Steps, false); } } } foreach (var stepDefinition in report.StepDefinitions) { if (stepDefinition.ScenarioStep == null) { CreateSampleStep(stepDefinition); } if (stepDefinition.Instances.Count == 0) { stepDefinition.Instances = null; } } return report; }
public Background(string keyword, string title, string description, ScenarioSteps scenarioSteps) { Keyword = keyword; Title = title ?? ""; Description = description ?? ""; Steps = scenarioSteps ?? new ScenarioSteps(); }
private ScenarioSteps CreateScenarioSteps(ScenarioOutline scenarioOutline, Dictionary <string, string> paramSubst) { ScenarioSteps result = new ScenarioSteps(); foreach (var scenarioStep in scenarioOutline.Steps) { var newStep = Clone(scenarioStep); newStep.Text = GetReplacedText(newStep.Text, paramSubst); newStep.MultiLineTextArgument = GetReplacedText(newStep.MultiLineTextArgument, paramSubst); if (newStep.TableArg != null) { foreach (var row in newStep.TableArg.Body) { foreach (var cell in row.Cells) { cell.Value = GetReplacedText(cell.Value, paramSubst); } } } result.Add(newStep); } return(result); }
public Scenario(string keyword, string title, string description, Tags tags, ScenarioSteps scenarioSteps) { Keyword = keyword; Title = title; Description = description; Tags = tags; Steps = scenarioSteps ?? new ScenarioSteps(); }
public void Add(ScenarioStep scenarioStep) { if (ScenarioSteps.ContainsKey(scenarioStep.Id)) { return; } ScenarioSteps.Add(scenarioStep.Id, scenarioStep); }
private void AppendSteps(ScenarioSteps steps, StringBuilder result) { foreach (var step in steps) { AppendStepLine(result, step); if (step.TableArg != null) { AppendTable(result, step.TableArg, indent + indent); } if (step.MultiLineTextArgument != null) { AppendMultiLineText(result, step.MultiLineTextArgument); } } }
// $ANTLR end "exampleSet" // $ANTLR start "steps" // SpecFlowLangWalker.g:147:1: steps returns [ScenarioSteps steps] : ^( STEPS (step_= step )+ ) ; public ScenarioSteps steps() // throws RecognitionException [1] { ScenarioSteps steps = default(ScenarioSteps); ScenarioStep step_ = default(ScenarioStep); steps = new ScenarioSteps(); try { // SpecFlowLangWalker.g:151:5: ( ^( STEPS (step_= step )+ ) ) // SpecFlowLangWalker.g:151:9: ^( STEPS (step_= step )+ ) { Match(input,STEPS,FOLLOW_STEPS_in_steps996); Match(input, Token.DOWN, null); // SpecFlowLangWalker.g:152:13: (step_= step )+ int cnt13 = 0; do { int alt13 = 2; int LA13_0 = input.LA(1); if ( ((LA13_0 >= GIVEN && LA13_0 <= THEN) || (LA13_0 >= AND && LA13_0 <= BUT)) ) { alt13 = 1; } switch (alt13) { case 1 : // SpecFlowLangWalker.g:152:14: step_= step { PushFollow(FOLLOW_step_in_steps1013); step_ = step(); state.followingStackPointer--; steps.Add(step_); } break; default: if ( cnt13 >= 1 ) goto loop13; EarlyExitException eee13 = new EarlyExitException(13, input); throw eee13; } cnt13++; } while (true); loop13: ; // Stops C# compiler whinging that label 'loop13' has no statements Match(input, Token.UP, null); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { } return steps; }
public ScenarioStep GetScenarioStep(uint id) => ScenarioSteps.ContainsKey(id) ? ScenarioSteps[id] : null;
public void SetTestBackgroundMethod(TestClassGenerationContext generationContext, CodeMemberMethod backgroundMethod, ScenarioSteps steps) { m_parametersDeclaredInMethod = new List <string>(); //reset it var classesDeclared = new List <string>(); foreach (ScenarioStep scenarioStep in steps) { classesDeclared = ClassesDeclared(generationContext, backgroundMethod, scenarioStep, classesDeclared); } }
public Background(string title, string description, ScenarioSteps scenarioSteps) { Title = title ?? ""; Description = description; Steps = scenarioSteps ?? new ScenarioSteps(); }
public void SetTestBackgroundMethod(TestClassGenerationContext generationContext, CodeMemberMethod backgroundMethod, ScenarioSteps steps) { m_parametersDeclaredInMethod = new List<string>(); //reset it var classesDeclared = new List<string>(); foreach (ScenarioStep scenarioStep in steps) { classesDeclared = ClassesDeclared(generationContext, backgroundMethod, scenarioStep, classesDeclared); } }
public void SetTestBackgroundMethod(TestClassGenerationContext generationContext, CodeMemberMethod backgroundMethod, ScenarioSteps steps) { throw new NotImplementedException(); }
public Scenario(string title, Tags tags, ScenarioSteps scenarioSteps) { Title = title; Tags = tags; Steps = scenarioSteps ?? new ScenarioSteps(); }
private ScenarioSteps CreateScenarioSteps(ScenarioOutline scenarioOutline, Dictionary<string, string> paramSubst) { ScenarioSteps result = new ScenarioSteps(); foreach (var scenarioStep in scenarioOutline.Steps) { var newStep = Clone(scenarioStep); newStep.Text = GetReplacedText(newStep.Text, paramSubst); newStep.MultiLineTextArgument = GetReplacedText(newStep.MultiLineTextArgument, paramSubst); if (newStep.TableArg != null) { foreach (var row in newStep.TableArg.Body) { foreach (var cell in row.Cells) { cell.Value = GetReplacedText(cell.Value, paramSubst); } } } result.Add(newStep); } return result; }
public ScenarioOutline(string keyword, string title, string description, Tags tags, ScenarioSteps scenarioSteps, Examples examples) : base(keyword, title, description, tags, scenarioSteps) { Examples = examples; }
public ScenarioOutline(string title, Tags tags, ScenarioSteps scenarioSteps, Examples examples) : base(title, tags, scenarioSteps) { Examples = examples; }
public Background(string title, ScenarioSteps scenarioSteps) { Title = title ?? ""; Steps = scenarioSteps ?? new ScenarioSteps(); }
private static ScenarioSteps CreateTestSteps(int numberOfSteps) { var steps = new ScenarioSteps(); for (var i = 0; i < numberOfSteps; i++) { steps.Add(CreateTestStep("text" + i, StepKeyword.Given)); } return steps; }
public Background(Text title, ScenarioSteps scenarioSteps) { Title = title == null ? "" : title.Value; Steps = scenarioSteps ?? new ScenarioSteps(); }
public Scenario GetScenario() { return(ScenarioBuilder .CreateScenario(Name, ScenarioSteps.ToArray()) .WithLoadSimulations(LoadSimulation.GetSimulation())); }