internal static void AddTestResultScreenshotDetail(object detail) { var testResultDetail = new TestResultDetail(); testResultDetail.AddTestResultDetail( TestResultDetailTypes.Screenshot, detail.ToString()); CurrentTestResult.Details.Add(testResultDetail); CurrentTestResult.SetScreenshot(detail.ToString()); }
// internal static bool AttachTestResultCode() // { // bool result = false; // // // // return result; // } internal static void AddTestResultTextDetail(ITestResultDetailCmdletBaseDataObject cmdlet, object detail) { ITestResultDetail testResultDetail = new TestResultDetail(); testResultDetail.AddTestResultDetail( TestResultDetailTypes.Comment, detail.ToString()); CurrentTestResult.Details.Add(testResultDetail); testResultDetail.DetailStatus = cmdlet.TestResultStatus; switch (cmdlet.TestResultStatus) { case TestResultStatuses.Failed: if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus) CurrentTestResult.enStatus = TestResultStatuses.Failed; break; case TestResultStatuses.Passed: if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus && TestResultStatuses.Failed != CurrentTestResult.enStatus) CurrentTestResult.enStatus = TestResultStatuses.Passed; break; case TestResultStatuses.NotTested: // nothing to do break; case TestResultStatuses.KnownIssue: CurrentTestResult.enStatus = TestResultStatuses.KnownIssue; break; default: // cmdlet.WriteVerbose(cmdlet, "TestResultStatus = ????"); // cmdlet.WriteVerbose(cmdlet, cmdlet.TestResultStatus.ToString()); break; } OnTmxNewTestResultDetailAdded(testResultDetail, null); if (cmdlet.Finished) { TmxHelper.TestCaseStarted = DateTime.Now; // 20130621 // TestData.CurrentTestScenario.TestResults.Add(new TestResult(TestData.CurrentTestScenario.Id, TestData.CurrentTestSuite.Id)); // TestData.CurrentTestScenario.TestResults[TestData.CurrentTestScenario.TestResults.Count - 1] = // TestData.CurrentTestResult; // 20130621 ITestResult newTestResult = new TestResult(TestData.CurrentTestScenario.Id, TestData.CurrentTestSuite.Id); if (TestData.CurrentTestResult == TestData.CurrentTestScenario.TestResults[TestData.CurrentTestScenario.TestResults.Count - 1]) { // autogeneration + Close-TmxTestResult TestData.CurrentTestScenario.TestResults.Add(newTestResult); TestData.CurrentTestResult = TestData.CurrentTestScenario.TestResults[TestData.CurrentTestScenario.TestResults.Count - 1]; } else { // Set-TmxCurrentTestResult + any closing TestData.CurrentTestScenario.TestResults.Add(TestData.CurrentTestResult); TestData.CurrentTestResult = newTestResult; } } }
// 20160116 // internal static void AddTestResultErrorDetail(ErrorRecord detail) internal static void AddTestResultErrorDetail(Exception detail) { var testResultDetail = new TestResultDetail(); testResultDetail.AddTestResultDetail( TestResultDetailTypes.ErrorRecord, detail); CurrentTestResult.Details.Add(testResultDetail); }
List<ITestResultDetail> importTestResultDetails(IEnumerable<XElement> testResultDetailElements) { var importedTestResultDetails = new List<ITestResultDetail>(); if (null == testResultDetailElements) return importedTestResultDetails; foreach (var testResultDetailElement in testResultDetailElements) { var detail = new TestResultDetail { TextDetail = getStringAttribute(testResultDetailElement, "name") }; string detailStatus = getStringAttribute(testResultDetailElement, "status"); switch (detailStatus.ToUpper()) { case "FAILED": detail.DetailStatus = TestResultStatuses.Failed; break; case "PASSED": detail.DetailStatus = TestResultStatuses.Passed; break; case "KNOWNISSUE": detail.DetailStatus = TestResultStatuses.KnownIssue; break; case "NOTTESTED": detail.DetailStatus = TestResultStatuses.NotTested; break; default: detail.DetailStatus = TestResultStatuses.NotTested; break; } } return importedTestResultDetails; }