Beispiel #1
0
 public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     try
     {
         m_command.Verify(commandCall, evaluator, resultRecorder);
     }
     catch (Exception e)
     {
         resultRecorder.Error(e);
         AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression);
     }
 }
 public override void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     try
     {
         m_command.Setup(commandCall, evaluator, resultRecorder);
     }
     catch (Exception e)
     {
         resultRecorder.Error(e);
         AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression);
     }
 }
Beispiel #3
0
        public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'run' is not supported");

            var element = commandCall.Element;

            var href = element.GetAttributeValue("href");

            Check.NotNull(href, "The 'href' attribute must be set for an element containing concordion:run");

            var runnerType = commandCall.Expression;
            var expression = element.GetAttributeValue("params", "concordion");

            if (expression != null)
            {
                evaluator.Evaluate(expression);
            }

            try
            {
                IRunner concordionRunner;
                Runners.TryGetValue(runnerType, out concordionRunner);

                // TODO - re-check this.
                Check.NotNull(concordionRunner, "The runner '" + runnerType + "' cannot be found. "
                              + "Choices: (1) Use 'concordion' as your runner (2) Ensure that the 'concordion.runner." + runnerType
                              + "' System property is set to a name of an IRunner implementation "
                              + "(3) Specify an assembly fully qualified class name of an IRunner implementation");

                var result = concordionRunner.Execute(evaluator.Fixture, commandCall.Resource, href).Result;

                if (result == Result.Success)
                {
                    resultRecorder.Success();
                    AnnounceSuccess(element);
                }
                else if (result == Result.Ignored)
                {
                    resultRecorder.Ignore();
                    AnnounceIgnored(element);
                }
                else
                {
                    resultRecorder.Failure(string.Format("test {0} failed", href), commandCall.Element.ToXml());
                    AnnounceFailure(element);
                }
            }
            catch (Exception e)
            {
                resultRecorder.Error(e);
                AnnounceError(e, element, expression);
            }
        }
        public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'run' is not supported");

            var element = commandCall.Element;

            var href = element.GetAttributeValue("href");
            Check.NotNull(href, "The 'href' attribute must be set for an element containing concordion:run");

            var runnerType = commandCall.Expression;
            var expression = element.GetAttributeValue("params", "concordion");

            if (expression != null)
            {
                evaluator.Evaluate(expression);
            }

            try
            {
                IRunner concordionRunner;
                Runners.TryGetValue(runnerType, out concordionRunner);

                // TODO - re-check this.
                Check.NotNull(concordionRunner, "The runner '" + runnerType + "' cannot be found. "
                        + "Choices: (1) Use 'concordion' as your runner (2) Ensure that the 'concordion.runner." + runnerType
                        + "' System property is set to a name of an IRunner implementation "
                        + "(3) Specify an assembly fully qualified class name of an IRunner implementation");

                var result = concordionRunner.Execute(evaluator.Fixture, commandCall.Resource, href).Result;

                if (result == Result.Success)
                {
                    resultRecorder.Success();
                    AnnounceSuccess(element);
                }
                else if (result == Result.Ignored)
                {
                    resultRecorder.Ignore();
                    AnnounceIgnored(element);
                }
                else
                {
                    resultRecorder.Failure(string.Format("test {0} failed", href), commandCall.Element.ToXml());
                    AnnounceFailure(element);
                }
            }
            catch (Exception e)
            {
                resultRecorder.Error(e);
                AnnounceError(e, element, expression);
            }
        }