示例#1
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);
        }
示例#2
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);
            }
        }