Beispiel #1
0
 public void Invoke(ExecutionContext context)
 {
     try
     {
         context.CurrentStep = this;
         context.ProgressNotifier.NotifyStepStart(_result.Name, _result.Number, context.TotalStepCount);
         _result.SetExecutionStart(DateTimeOffset.UtcNow);
         MeasuredInvoke();
         _result.SetStatus(ResultStatus.Passed);
     }
     catch (StepBypassException e)
     {
         _result.SetStatus(ResultStatus.Bypassed, e.Message);
     }
     catch (Exception e)
     {
         _result.SetStatus(_mapping(e.GetType()), e.Message);
         throw;
     }
     finally
     {
         context.CurrentStep = null;
         context.ProgressNotifier.NotifyStepFinished(_result, context.TotalStepCount);
     }
 }
Beispiel #2
0
        public async Task RunAsync()
        {
            bool stepStartNotified = false;

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

                await _extendableExecutor.ExecuteStepAsync(this, TimeMeasuredInvokeAsync);

                _result.SetStatus(ExecutionStatus.Passed);
            }
            catch (StepBypassException e)
            {
                _result.SetStatus(ExecutionStatus.Bypassed, e.Message);
            }
            catch (Exception e)
            {
                _result.SetStatus(_exceptionToStatusMapper(e), e.Message);
                throw;
            }
            finally
            {
                if (stepStartNotified)
                {
                    _progressNotifier.NotifyStepFinished(_result);
                }
            }
        }
Beispiel #3
0
 public void Invoke()
 {
     try
     {
         _action();
         _result.SetStatus(ResultStatus.Passed);
     }
     catch (Exception e)
     {
         _result.SetStatus(_mapping(e.GetType()), e.Message);
         throw;
     }
 }
Beispiel #4
0
        private void InvokeStepWithEvaluatedParameters(ExecutionContext context)
        {
            _result = new StepResult(_stepNumber, new StepName(_stepNameFormat, _formattedStepTypeName, GetParameterDetails()), ResultStatus.NotRun);

            context.ProgressNotifier.NotifyStepStart(_result.Name, _stepNumber, context.TotalStepCount);
            MeasuredInvoke(_parameters.Select(p => p.Value).ToArray());

            _result.SetStatus(ResultStatus.Passed);
        }
Beispiel #5
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);
        }
Beispiel #6
0
 public void Invoke(ExecutionContext context)
 {
     try
     {
         context.CurrentStep = this;
         InvokeStep(context);
     }
     catch (StepBypassException e)
     {
         _result.SetStatus(ResultStatus.Bypassed, e.Message);
     }
     catch (Exception e)
     {
         _result.SetStatus(_mapping(e.GetType()), e.Message);
         throw;
     }
     finally
     {
         context.CurrentStep = null;
         context.ProgressNotifier.NotifyStepFinished(_result, context.TotalStepCount);
     }
 }
Beispiel #7
0
 private void UpdateStepStatus()
 {
     _result.UpdateException(null);
     _result.SetStatus(_result.GetSubSteps().GetMostSevereOrNull()?.Status ?? ExecutionStatus.Passed);
 }