Ejemplo n.º 1
0
        // 20130331
        //internal static void AddTestResultTextDetail(object detail)
        internal static void AddTestResultTextDetail(TestResultDetailCmdletBase cmdlet, object detail)
        {
            ITestResultDetail testResultDetail =
                new TestResultDetail();

            if (TestData.TestSuites.Count == 0) {
                InitTestData();
            }

            testResultDetail.AddTestResultDetail(
                TestResultDetailTypes.Comment,
                detail.ToString());
            CurrentTestResult.Details.Add(testResultDetail);

            // 20130402
            testResultDetail.DetailStatus = cmdlet.TestResultStatus;

            // 20130331
            switch (cmdlet.TestResultStatus) {
                case TestResultStatuses.Failed:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = Failed");
                    // 20130402
                    //CurrentTestResult.enStatus = TestResultStatuses.Failed;
                    if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus) {

                        CurrentTestResult.enStatus = TestResultStatuses.Failed;
                    }
                    break;
                case TestResultStatuses.Passed:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = Passed");
                    // 20130402
                    //CurrentTestResult.enStatus = TestResultStatuses.Passed;
                    if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus &&
                        TestResultStatuses.Failed != CurrentTestResult.enStatus) {

                        CurrentTestResult.enStatus = TestResultStatuses.Passed;
                    }
                    break;
                case TestResultStatuses.NotTested:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = NotTested");
                    // nothing to do
                    break;
                case TestResultStatuses.KnownIssue:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = KnownIssue");
                    CurrentTestResult.enStatus = TestResultStatuses.KnownIssue;
                    break;
                default:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = ????");
                    cmdlet.WriteVerbose(cmdlet, cmdlet.TestResultStatus.ToString());
                    break;
            }

            OnTMXNewTestResultDetailAdded(testResultDetail, null);

            // 20130402
            if (cmdlet.Finished) {

                TMXHelper.TestCaseStarted =
                    System.DateTime.Now;

                TestData.CurrentTestScenario.TestResults.Add(new TestResult(TestData.CurrentTestScenario.Id, TestData.CurrentTestSuite.Id));
                TestData.CurrentTestScenario.TestResults[TestData.CurrentTestScenario.TestResults.Count - 1] =
                    TestData.CurrentTestResult;

            }
        }
Ejemplo n.º 2
0
        // 20130331
        //internal static void AddTestResultTextDetail(object detail)
        internal static void AddTestResultTextDetail(TestResultDetailCmdletBase 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:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = Failed");
                    if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus) {

                        CurrentTestResult.enStatus = TestResultStatuses.Failed;
                    }
                    break;
                case TestResultStatuses.Passed:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = Passed");
                    if (TestResultStatuses.KnownIssue != CurrentTestResult.enStatus &&
                        TestResultStatuses.Failed != CurrentTestResult.enStatus) {

                        CurrentTestResult.enStatus = TestResultStatuses.Passed;
                    }
                    break;
                case TestResultStatuses.NotTested:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = NotTested");
                    // nothing to do
                    break;
                case TestResultStatuses.KnownIssue:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = KnownIssue");
                    CurrentTestResult.enStatus = TestResultStatuses.KnownIssue;
                    break;
                default:
                    cmdlet.WriteVerbose(cmdlet, "TestResultStatus = ????");
                    cmdlet.WriteVerbose(cmdlet, cmdlet.TestResultStatus.ToString());
                    break;
            }

            OnTMXNewTestResultDetailAdded(testResultDetail, null);

            // 20130402
            if (cmdlet.Finished) {

                TMXHelper.TestCaseStarted =
                    System.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;
                }
            }
        }