Exemplo n.º 1
0
        // 20130322
        //internal static TestStat RefreshScenarioStatistics(TestScenario scenario)
        internal static TestStat RefreshScenarioStatistics(TestScenario scenario, bool skipAutomatic)
        {
            TestStat ts = new TestStat();

            if (null != scenario.TestResults && 0 < scenario.TestResults.Count) {

                ts.All = scenario.TestResults.Count;
                foreach (TestResult tr in scenario.TestResults) {

                    // 20130322
                    if (skipAutomatic) {
                        if (TestResultOrigins.Automatic == tr.Origin) {
                            continue;
                        }
                    }

                    if (tr.enStatus == TestResultStatuses.Passed ||
                        tr.enStatus == TestResultStatuses.KnownIssue) {
                        ts.Passed++;
                        if (tr.enStatus == TestResultStatuses.KnownIssue){
                            ts.PassedButWithBadSmell++;
                        }
                    }
                    if (tr.enStatus == TestResultStatuses.Failed) {
                        ts.Failed++;
                    }
                    ts.TimeSpent += tr.TimeSpent;
                }
            }
            ts.NotTested =
                ts.All -
                ts.Passed -
                ts.Failed;
            scenario.Statistics = ts;
            return ts;
        }
Exemplo n.º 2
0
        private string getStatisticsStringScenario(TestScenario scenario)
        {
            string result = string.Empty;
            TestData.RefreshScenarioStatistics(scenario);
            result += @"<div id=""scenariostat"">";

            // test results
            result += @"Test cases:";
            result += scenario.Statistics.All.ToString();
            result += "  Passed:";
            result += scenario.Statistics.Passed.ToString();
            result += "  Failed:";
            result += scenario.Statistics.Failed.ToString();
            result += "  Not tested:";
            result += scenario.Statistics.NotTested.ToString();
            result += "  Time spent:";
            result += Convert.ToInt32(scenario.Statistics.TimeSpent).ToString();
            result += @" seconds</div>";
            return result;
        }
Exemplo n.º 3
0
        public void RunTestCase(
			TestCaseExecCmdletBase cmdlet,
			TestSuite testSuite,
			TestScenario testScenario)
        {
            ITestCase testCase =
                TMX.TestData.GetTestCase(
                    testSuite,
                    string.Empty, //cmdlet.Name
                    cmdlet.Id,
                    testScenario.Name,
                    testScenario.Id,
                    testSuite.Name,
                    testSuite.Id,
                    testScenario.PlatformId);
            if (null == testCase) {
                return;
            }

            // run BeforeScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    testSuite.BeforeScenario,
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.BeforeScenarioParameters);
            }

            // run BeforeTest scriptblocks
            if (null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    testScenario.BeforeTest,
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.BeforeTestParameters);
            }

            // run TestCode scriptblocks
            cmdlet.runTwoScriptBlockCollections(
                //cmdlet.TestCode,
                testCase.TestCode,
                null,
                cmdlet,
                cmdlet.TestCodeParameters);

            // run AfterTest scriptblocks
            if (null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    testScenario.AfterTest,
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.AfterTestParameters);
            }

            // run AfterScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    testSuite.AfterScenario,
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.AfterScenarioParameters);
            }
        }