Ejemplo n.º 1
0
        public async Task ExecuteAsync(IScenarioOutput scenarioOutput)
        {
            if (scenarioOutput == null)
            {
                throw new ArgumentNullException(nameof(scenarioOutput));
            }

            var step = _steps.GetEnumerator();

            while (step.MoveNext())
            {
                try
                {
                    await step.Current.ExecuteAsync();

                    scenarioOutput.StepPassed($"{step.Current.Kind} {step.Current.StepText}");
                }
                catch
                {
                    scenarioOutput.StepFailed($"{step.Current.Kind} {step.Current.StepText}");

                    while (step.MoveNext())
                    {
                        scenarioOutput.StepSkipped($"{step.Current.Kind} {step.Current.StepText}");
                    }

                    throw;
                }
            }
        }
Ejemplo n.º 2
0
        public async Task ExecuteAsync(Feature feature, IScenarioOutput scenarioOutput)
        {
            if (scenarioOutput == null)
            {
                throw new ArgumentNullException(nameof(scenarioOutput));
            }

            var step = _steps.GetEnumerator();

            while (step.MoveNext())
            {
                try
                {
                    await step.Current.ExecuteAsync(feature.ScenarioContext);

                    scenarioOutput.StepPassed($"{step.Current.Kind} {step.Current.StepText}");
                }
                catch
                {
                    try
                    {
                        feature.OnStepFailed(_scenarioName, step.Current.StepText);
                    }
                    catch (Exception ex)
                    {
                        feature.InternalOutput.WriteLine(ex.ToString());
                    }

                    scenarioOutput.StepFailed($"{step.Current.Kind} {step.Current.StepText}");

                    while (step.MoveNext())
                    {
                        scenarioOutput.StepSkipped($"{step.Current.Kind} {step.Current.StepText}");
                    }

                    throw;
                }
            }

            feature.OnScenarioComplete(_scenarioName);
        }
Ejemplo n.º 3
0
        public async Task ExecuteAsync(IScenarioOutput scenarioOutput)
        {
            if (scenarioOutput == null)
            {
                throw new ArgumentNullException(nameof(scenarioOutput));
            }

            await _instance.InvokeAsync(BeforeAfterAttributeHelper.InvokeMethodType.BeforeScenario);

            var step = _steps.GetEnumerator();

            try
            {
                while (step.MoveNext())
                {
                    try
                    {
                        await step.Current.ExecuteAsync();

                        scenarioOutput.StepPassed($"{step.Current.Kind} {step.Current.StepText}");
                    }
                    catch
                    {
                        scenarioOutput.StepFailed($"{step.Current.Kind} {step.Current.StepText}");

                        while (step.MoveNext())
                        {
                            scenarioOutput.StepSkipped($"{step.Current.Kind} {step.Current.StepText}");
                        }

                        throw;
                    }
                }
            }
            finally
            {
                await _instance.InvokeAsync(BeforeAfterAttributeHelper.InvokeMethodType.AfterScenario);
            }
        }