public void Process(Story story)
        {
            foreach (var scenario in story.Scenarios)
            {
                var executor = new ScenarioExecutor(scenario);
                executor.InitializeScenario();

                if (scenario.Example != null)
                {
                    var unusedValue = scenario.Example.Values.FirstOrDefault(v => !v.ValueHasBeenUsed);
                    if (unusedValue != null) throw new UnusedExampleException(unusedValue);
                }

                var stepFailed = false;
                foreach (var executionStep in scenario.Steps)
                {
                    if (stepFailed && ShouldExecuteStepWhenPreviousStepFailed(executionStep))
                        break;

                    if (executor.ExecuteStep(executionStep) == Result.Passed) 
                        continue;

                    if (!executionStep.Asserts)
                        break;

                    stepFailed = true;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Runs all the dispose methods in the scenario
        /// </summary>
        /// <param name="scenario"></param>
        private static void Dispose(Scenario scenario)
        {
            var disposeSteps = scenario
                .Steps
                .Where(s => s.ExecutionOrder == ExecutionOrder.TearDown && s.Result == Result.NotExecuted);

            var executor = new ScenarioExecutor(scenario);

            foreach (var disposeStep in disposeSteps)
                executor.ExecuteStep(disposeStep);
        }
Exemple #3
0
        /// <summary>
        /// Runs all the dispose methods in the scenario
        /// </summary>
        /// <param name="scenario"></param>
        private static void Dispose(Scenario scenario)
        {
            var disposeSteps = scenario
                               .Steps
                               .Where(s => s.ExecutionOrder == ExecutionOrder.TearDown && s.Result == Result.NotExecuted);

            var executor = new ScenarioExecutor(scenario);

            foreach (var disposeStep in disposeSteps)
            {
                executor.ExecuteStep(disposeStep);
            }
        }
        public void Process(Story story)
        {
            foreach (var scenario in story.Scenarios)
            {
                var executor = new ScenarioExecutor(scenario);
                executor.InitializeScenario();

                if (scenario.Example != null)
                {
                    var unusedValue = scenario.Example.Values.FirstOrDefault(v => !v.ValueHasBeenUsed);
                    if (unusedValue != null)
                    {
                        throw new UnusedExampleException(unusedValue);
                    }
                }

                var stepFailed = false;

                foreach (var executionStep in scenario.Steps)
                {
                    executionStep.ResetTitle();
                    if (stepFailed && ShouldExecuteStepWhenPreviousStepFailed(executionStep))
                    {
                        break;
                    }

                    if (executor.ExecuteStep(executionStep) == Result.Passed)
                    {
                        continue;
                    }

                    if (!executionStep.Asserts)
                    {
                        break;
                    }
                    stepFailed = true;
                }
            }
        }