public void AppendStep(AutomationStep stepDefinition)
 {
     _steps.Add(stepDefinition);
 }
 public void AppendStep(string description, Action<IWebDriver, dynamic> execute, Action<IWebDriver> reset = null)
 {
     var step = new AutomationStep(description, execute, reset);
     AppendStep(step);
 }
예제 #3
0
 protected void AddStep(AutomationStep step)
 {
     _steps.Add(step);
 }
        private AutomationStepRunResult ExecuteStep(AutomationStep step, IWebDriver driver, dynamic state)
        {
            var stepRunResult = new AutomationStepRunResult(step)
            {
                StartTime = DateTime.Now
            };

            Log("[{0}] Starting step '{1}'...", DateTime.Now, step.Description);

            for (int i = 0; i < _options.MaxAllowedStepFailCount; i++)
            {
                stepRunResult.TotalAttemptCount += 1;

                try
                {
                    step.Execute(driver, state);
                    stepRunResult.WasSuccessful = true;

                    Log("[{0}]    Success", DateTime.Now);

                    break;
                }
                catch (Exception ex)
                {
                    stepRunResult.AppendFailedExecution(DateTime.Now, ex);

                    Log("[{0}]    Failure #{1}: {2}", DateTime.Now, stepRunResult.FailedAttemptCount, ex.Message);
                }

            }

            var resultText = stepRunResult.WasSuccessful ? "succeeded" : "failed";

            Log("[{0}] Step '{3}' {1} after {2} attempts.", DateTime.Now, resultText, stepRunResult.TotalAttemptCount, step.Description);

            stepRunResult.EndTime = DateTime.Now;

            return stepRunResult;
        }
 public AutomationStepRunResult(AutomationStep step)
 {
     _step = step;
     _failedExecutions = new List<FailedAutomationStepExecution>();
 }