示例#1
0
 private void StopStep(ExecutionTimeWatch watch, bool stepStartNotified)
 {
     ScenarioExecutionContext.Current.Get <CurrentStepProperty>().RemoveCurrent(this);
     DisposeComposite();
     watch.Stop();
     _result.SetExecutionTime(watch.GetTime());
     _result.IncludeSubStepDetails();
     if (stepStartNotified)
     {
         _stepContext.ProgressNotifier.NotifyStepFinished(_result);
     }
 }
示例#2
0
        public async Task RunAsync()
        {
            var exceptionCollector = new ExceptionCollector();
            var stepStartNotified  = false;

            try
            {
                EvaluateParameters();
                _progressNotifier.NotifyStepStart(_result.Info);
                stepStartNotified = true;

                await TimeMeasuredInvokeAsync();

                _result.SetStatus(_result.GetSubSteps().GetMostSevereOrNull()?.Status ?? ExecutionStatus.Passed);
            }
            catch (StepExecutionException e)
            {
                _result.SetStatus(e.StepStatus);
            }
            catch (ScenarioExecutionException exception) when(exception.InnerException is StepBypassException)
            {
                _result.SetStatus(ExecutionStatus.Bypassed, exception.InnerException.Message);
            }
            catch (ScenarioExecutionException exception)
            {
                _exceptionProcessor.UpdateResultsWithException(_result.SetStatus, exception.InnerException);
                exceptionCollector.Capture(exception);
            }
            catch (Exception exception)
            {
                _exceptionProcessor.UpdateResultsWithException(_result.SetStatus, exception);
                exceptionCollector.Capture(exception);
            }
            finally
            {
                DisposeCompositeStep(exceptionCollector);
                _result.IncludeSubStepDetails();
                if (stepStartNotified)
                {
                    _progressNotifier.NotifyStepFinished(_result);
                }
            }
            ProcessExceptions(exceptionCollector);
        }