Exemplo n.º 1
0
        private void StopScenario(ExecutionTimeWatch watch)
        {
            ScenarioExecutionContext.Current = null;
            DisposeScope();
            watch.Stop();
            _result.UpdateResult(
                _preparedSteps.Select(s => s.Result).ToArray(),
                watch.GetTime());

            _scenarioContext.ProgressNotifier.NotifyScenarioFinished(_result);
            _scenarioContext.OnScenarioFinished?.Invoke(_result);
        }
Exemplo n.º 2
0
        public async Task RunAsync()
        {
            var exceptionCollector = new ExceptionCollector();

            _progressNotifier.NotifyScenarioStart(_info);
            var watch = ExecutionTimeWatch.StartNew();

            try
            {
                InitializeScenario();
                await _decoratingExecutor.ExecuteScenarioAsync(this, RunScenarioAsync, _scenarioDecorators);
            }
            catch (StepExecutionException ex)
            {
                _result.UpdateScenarioResult(ex.StepStatus);
            }
            catch (ScenarioExecutionException ex) when(ex.InnerException is StepBypassException)
            {
                _result.UpdateScenarioResult(ExecutionStatus.Bypassed, ex.InnerException.Message);
            }
            catch (ScenarioExecutionException ex)
            {
                _exceptionProcessor.UpdateResultsWithException(_result.UpdateScenarioResult, ex.InnerException);
                exceptionCollector.Capture(ex);
            }
            catch (Exception ex)
            {
                _exceptionProcessor.UpdateResultsWithException(_result.UpdateScenarioResult, ex);
                exceptionCollector.Capture(ex);
            }
            finally
            {
                DisposeContext(exceptionCollector);
                watch.Stop();

                _result.UpdateResult(
                    _preparedSteps.Select(s => s.Result).ToArray(),
                    watch.GetTime());

                _progressNotifier.NotifyScenarioFinished(Result);
            }

            ProcessExceptions(exceptionCollector);
        }
Exemplo n.º 3
0
        public async Task RunAsync()
        {
            _progressNotifier.NotifyScenarioStart(_scenario);
            var watch = ExecutionTimeWatch.StartNew();

            try
            {
                await _extendableExecutor.ExecuteScenarioAsync(_scenario, RunScenarioAsync);
            }
            finally
            {
                watch.Stop();

                _result.UpdateResult(
                    _preparedSteps.Select(s => s.Result).ToArray(),
                    watch.GetTime(),
                    _scenarioInitializationException);

                _progressNotifier.NotifyScenarioFinished(Result);
            }
        }