Ejemplo n.º 1
0
        /// <summary>
        /// Wraps method into AllureStep.
        /// </summary>
        public static void WrapInStep(this AllureLifecycle lifecycle, Action action, string stepName = "", [CallerMemberName] string callerName = "")
        {
            if (string.IsNullOrEmpty(stepName))
            {
                stepName = callerName;
            }

            var id         = Guid.NewGuid().ToString();
            var stepResult = new StepResult {
                name = stepName
            };

            try
            {
                lifecycle.StartStep(id, stepResult);
                action.Invoke();
                lifecycle.StopStep(step => stepResult.status = Status.passed);
            }
            catch (Exception e)
            {
                lifecycle.StopStep(step =>
                {
                    step.statusDetails = new StatusDetails
                    {
                        message = e.Message,
                        trace   = e.StackTrace
                    };
                    step.status = AllureNUnitHelper.GetNUnitStatus();
                });
                throw;
            }
        }
Ejemplo n.º 2
0
        public static void WrapInStep(this AllureLifecycle allureInstance, Action action, string stepName = "")
        {
            var id         = Guid.NewGuid().ToString();
            var stepResult = new StepResult {
                name = stepName
            };

            try
            {
                allureInstance.StartStep(id, stepResult);
                action.Invoke();
                allureInstance.StopStep(step => stepResult.status = Status.passed);
            }
            catch (ArgumentNullException)
            {
                Console.WriteLine($" > WARN - You can't use step {stepName} here. Allure hasn't been initialized");
                action.Invoke();
            }
            catch (Exception ex)
            {
                allureInstance.StopStep(step =>
                {
                    step.stage         = Stage.finished;
                    step.status        = Status.failed;
                    step.statusDetails = GetStatusDetails(ex);
                });
                throw;
            }
        }
Ejemplo n.º 3
0
 public static bool stopStep(Status status)
 {
     try
     {
         instance.UpdateStep(x => x.status = status);
         instance.UpdateStep(x => x.stage  = Stage.finished);
         instance.StopStep();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 void ITestTracer.TraceStepDone(BindingMatch match, object[] arguments, TimeSpan duration)
 {
     base.TraceStepDone(match, arguments, duration);
     allure.StopStep(x => x.status = Status.passed);
 }