private string BuildTitle(TestResult successful) { var sb = new StringBuilder(); if (!successful.WasExecuted) { sb.AppendFormat("{0}", "Inconclusive"); } else { sb.AppendFormat("{0}", successful.WasSuccessful ? "Successful" : "Failed"); } if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName) && !string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion)) { sb.AppendFormat(" with {0} version {1}", this.configuration.SystemUnderTestName, this.configuration.SystemUnderTestVersion); } else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName)) { sb.AppendFormat(" with {0}", this.configuration.SystemUnderTestName); } else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion)) { sb.AppendFormat(" with version {0}", this.configuration.SystemUnderTestVersion); } return sb.ToString(); }
private string BuildTitle(TestResult successful) { var sb = new StringBuilder(); switch (successful) { default: case TestResult.Inconclusive: sb.AppendFormat("{0}", "Inconclusive"); break; case TestResult.Passed: sb.AppendFormat("{0}", "Successful"); break; case TestResult.Failed: sb.AppendFormat("{0}", "Failed"); break; } if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName) && !string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion)) { sb.AppendFormat(" with {0} version {1}", this.configuration.SystemUnderTestName, this.configuration.SystemUnderTestVersion); } else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName)) { sb.AppendFormat(" with {0}", this.configuration.SystemUnderTestName); } else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion)) { sb.AppendFormat(" with version {0}", this.configuration.SystemUnderTestVersion); } return sb.ToString(); }
public JsonFeatureWithMetaInfo(FeatureNode featureNodeTreeNode, TestResult result) { var jsonMapper = new JsonMapper(); this.Feature = jsonMapper.Map(featureNodeTreeNode.Feature); this.RelativeFolder = featureNodeTreeNode.RelativePathFromRoot; this.Result = jsonMapper.Map(result); }
private XElement BuildImageElement(TestResult result, string elementName = "div") { return new XElement( this.xmlns + elementName, new XAttribute("class", "float-right"), new XElement( this.xmlns + "i", new XAttribute("class", this.DetermineClass(result)), new XAttribute("title", this.BuildTitle(result)), " ")); }
private string DetermineClass(TestResult result) { if (!result.WasExecuted) { return "icon-warning-sign inconclusive"; } else { return result.WasSuccessful ? "icon-ok passed" : "icon-minus-sign failed"; } }
protected static TestResult EvaluateTestResults(TestResult[] results) { if (results.Any(r => r == TestResult.Failed)) { return TestResult.Failed; } if (results.Any(r => r == TestResult.Passed)) { return TestResult.Passed; } return TestResult.Inconclusive; }
public TestResult GetExampleResult(ScenarioOutline scenarioOutline, string[] row) { IEnumerable<XElement> exampleElements = this.GetScenarioOutlineElements(scenarioOutline); var result = new TestResult(); foreach (XElement exampleElement in exampleElements) { Regex signature = this.exampleSignatureBuilder.Build(scenarioOutline, row); if (signature.IsMatch(exampleElement.Attribute("name").Value.ToLowerInvariant())) { return this.GetResultFromElement(exampleElement); } } return result; }
public TestResult GetExampleResult(ScenarioOutline scenarioOutline, string[] row) { IEnumerable<XElement> exampleElements = this.GetScenarioOutlineElements(scenarioOutline); var result = new TestResult(); var signatureBuilder = this.ExampleSignatureBuilder; if (signatureBuilder == null) { throw new InvalidOperationException("You need to set the ExampleSignatureBuilder before using GetExampleResult."); } foreach (XElement exampleElement in exampleElements) { Regex signature = signatureBuilder.Build(scenarioOutline, row); if (signature.IsMatch(exampleElement.Attribute("name").Value.ToLowerInvariant())) { return this.GetResultFromElement(exampleElement); } } return result; }
protected static TestResult EvaluateTestResults(TestResult[] results) { return results.Merge(true); }
private string DetermineClass(TestResult result) { switch (result) { default: case TestResult.Inconclusive: return "icon-warning-sign inconclusive"; case TestResult.Passed: return "icon-ok passed"; case TestResult.Failed: return "icon-minus-sign failed"; } }
private TestResult GetResultFromElement(XElement element) { var result = new TestResult(); XAttribute resultAttribute = element.Attribute("result"); switch (resultAttribute.Value.ToLowerInvariant()) { case "skip": result.WasExecuted = false; result.WasSuccessful = false; break; case "pass": result.WasExecuted = true; result.WasSuccessful = true; break; case "fail": result.WasExecuted = true; result.WasSuccessful = false; break; default: result.WasExecuted = false; result.WasSuccessful = false; break; } return result; }
public JsonTestResult Map(TestResult testResult) { return this.mapper.Map<JsonTestResult>(testResult); }
private static JsonTestResult ToJsonTestResult(TestResult testResult) { switch (testResult) { case TestResult.Failed: return new JsonTestResult { WasExecuted = true, WasSuccessful = false }; case TestResult.Passed: return new JsonTestResult { WasExecuted = true, WasSuccessful = true }; default: return new JsonTestResult { WasExecuted = false, WasSuccessful = false }; } }
public bool Equals(TestResult other) { return this.WasExecuted.Equals(other.WasExecuted) && this.WasSuccessful.Equals(other.WasSuccessful); }
public FeatureWithMetaInfo(FeatureNode featureNodeTreeNode, TestResult result) : this(featureNodeTreeNode) { this.Result = result; }