Exemple #1
0
        public ProtoExecutionResult ExecuteHooks(string hookType, HooksStrategy strategy, IList <string> applicableTags,
                                                 ExecutionContext context)
        {
            var stopwatch = Stopwatch.StartNew();
            var result    = new ProtoExecutionResult
            {
                Failed = false
            };

            var executionResult = _hookExecutor.Execute(hookType, strategy, applicableTags, context);

            result.ExecutionTime = stopwatch.ElapsedMilliseconds;
            if (executionResult.Success)
            {
                return(result);
            }
            var elapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            result.Failed = true;
            var isScreenShotEnabled = Utils.TryReadEnvValue("SCREENSHOT_ON_FAILURE");

            if (isScreenShotEnabled == null || isScreenShotEnabled.ToLower() != "false")
            {
                result.ScreenShot = TakeScreenshot();
            }
            result.ErrorMessage     = executionResult.ExceptionMessage;
            result.StackTrace       = executionResult.StackTrace;
            result.RecoverableError = executionResult.Recoverable;
            result.ExecutionTime    = elapsedMilliseconds;

            return(result);
        }
Exemple #2
0
        public ProtoExecutionResult ExecuteHooks(string hookType, HooksStrategy strategy, IList <string> applicableTags,
                                                 ExecutionContext context)
        {
            var stopwatch       = Stopwatch.StartNew();
            var executionResult = _hookExecutor.Execute(hookType, strategy, applicableTags, context);

            return(BuildResult(stopwatch, executionResult));
        }