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); }
private void UpdateStepStatus() { _result.UpdateException(null); _result.SetStatus(_result.GetSubSteps().GetMostSevereOrNull()?.Status ?? ExecutionStatus.Passed); }