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); } }
private void AddToTestResults(IResultSummary singleResult, IResultRecorder resultSummary) { if (resultSummary == null) { return; } if (singleResult.HasExceptions) { resultSummary.AddResultDetails(singleResult.ErrorDetails); } else if (singleResult.HasFailures) { resultSummary.AddResultDetails(singleResult.FailureDetails); } else { resultSummary.Success(); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'assertEquals' is not supported"); Element element = commandCall.Element; object actual = evaluator.Evaluate(commandCall.Expression); string expected = element.Text; if (this.m_Comparer.Compare(actual, expected) == 0) { resultRecorder.Success(); AnnounceSuccess(element); } else { resultRecorder.Failure(string.Format("expected {0} but was {1}", expected, actual), element.ToXml()); AnnounceFailure(element, expected, actual); } }
protected override void ProcessTrueResult(CommandCall commandCall, IResultRecorder resultRecorder) { resultRecorder.Success(); AnnounceSuccess(commandCall.Element); }
private void AddToTestResults(IResultSummary singleResult, IResultRecorder resultSummary) { if (resultSummary == null) return; if (singleResult.HasExceptions) { resultSummary.AddResultDetails(singleResult.ErrorDetails); } else if (singleResult.HasFailures) { resultSummary.AddResultDetails(singleResult.FailureDetails); } else { resultSummary.Success(); } }