Beispiel #1
0
        private void Create()
        {
            SetFeatureTitle();
            SetFeatureDescription();

            var scenario = new SquashScenario();

            while (_cabinet.PeekNextLine() != null)
            {
                var row = _cabinet.PeekNextLine();
                if (string.IsNullOrWhiteSpace(row))
                {
                    continue;
                }

                //tags
                if (row.StartsWith("@"))
                {
                    var newscenario = CreateScenarioWithTags();
                    SquashLogger.Debug($"Feature {Name} has scenario {newscenario.Name} with tags {string.Join(",",newscenario.Tags)}");
                    Scenarios.Add(newscenario);
                    continue;
                }

                //scenario
                if (row.StartsWith("Scenario:"))
                {
                    var newscenario = CreateScenario();
                    SquashLogger.Debug($"Feature {Name} has scenario {newscenario.Name}");
                    Scenarios.Add(newscenario);
                    continue;
                }

                //scenario
                if (row.StartsWith("Scenario Outline:"))
                {
                    var newscenario = CreateScenarioOutline();
                    SquashLogger.Debug($"Feature {Name} has scenario outline {newscenario.Name} with scenarios {string.Join(",", newscenario.Scenarios.Select(s => s.Name))}");
                    Scenarios.Add(newscenario);
                    continue;
                }
            }
        }
Beispiel #2
0
        private SquashScenario CreateScenario()
        {
            var scenario = new SquashScenario();

            scenario.Name = _cabinet.GetNextLine().Split(':')[1];

            while (_cabinet.PeekNextLine() != null && !IsStartOfSection(_cabinet.PeekNextLine()))
            {
                var step = CreateStep();

                //if (step == null)
                //{
                //    currentLine--;
                //    break;
                //}

                scenario.StepDefinitions.Add(step);
            }

            return(scenario);
        }