A test case group in the run page.
Inheritance: INotifyPropertyChanged
コード例 #1
0
        /// <summary>
        /// Check the test cases in the playlist.
        /// </summary>
        /// <param name="numberOfChecked">Number of checked cases.</param>
        /// <param name="numberOfNotfound">Number of not found test cases in the list.</param>
        public void ApplyPlaylist(out int numberOfChecked, out int numberOfNotfound)
        {
            numberOfChecked  = 0;
            numberOfNotfound = 0;
            TestCaseGroup.HoldUpdatingHeader();
            foreach (var testcase in selectedCases)
            {
                if (!caselistCache.Contains(testcase.Name) && !testcase.IsChecked)
                {
                    testcase.IsChecked = false;
                }
            }
            TestCaseGroup.ResumeUpdatingHeader();

            foreach (string name in caselistCache)
            {
                var testcase = selectedCases.FirstOrDefault((v) => v.FullName == name);
                if (testcase != null)
                {
                    if (!testcase.IsChecked)
                    {
                        testcase.IsChecked = true;
                    }
                    numberOfChecked++;
                }
                else
                {
                    numberOfNotfound++;
                }
            }
        }
コード例 #2
0
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            locker.EnterReadLock();
            try
            {
                TestCaseGroup from = testcasemap[testCaseName];
                TestCaseGroup to   = OtherTestCases;
                if (from == null)
                {
                    return;
                }
                TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);
                // If changed to Running/Waiting status, no need to change group.

                if (RunningTestCase != null)
                {
                    if (RunningTestCase.Status == TestCaseStatus.Running)
                    {
                        RunningTestCase.Status = TestCaseStatus.Waiting;
                    }
                }
                RunningTestCase        = testcase;
                RunningTestCase.Status = status;
                if (UpdateTestCaseList != null)
                {
                    UpdateTestCaseList(from, RunningTestCase);
                }
                return;
            }
            finally
            {
                locker.ExitReadLock();
            }
        }
コード例 #3
0
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to   = OtherTestCases;

            if (from == null)
            {
                return;
            }
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);

            if (status == TestCaseStatus.Running)
            {
                RunningTestCase = testcase;
            }
            switch (status)
            {
            case TestCaseStatus.Running:
                to = InProgressTestCases;
                break;

            case TestCaseStatus.Passed:
                testcase.IsChecked = false;
                to = PassedTestCases;
                break;

            case TestCaseStatus.Failed:
                testcase.IsChecked = true;
                to = FailedTestCases;
                break;

            case TestCaseStatus.Other:
                to = OtherTestCases;
                break;

            case TestCaseStatus.NotRun:
                to = NotRunTestCases;
                break;
            }

            testcase.Status = status;
            if (UpdateTestCaseStatus != null)
            {
                UpdateTestCaseStatus(from, to, testcase);
            }
            else
            {
                from.RemoveTestCase(testcase);
                to.AddTestCase(testcase);
            }
            testcasemap[testCaseName] = to;
        }
コード例 #4
0
        public void SetTestCaseList(List <TestCase> testcases)
        {
            NotRunTestCases = new TestCaseGroup("Not Run", testcases.Count);
            PassedTestCases = new TestCaseGroup("Passed", testcases.Count);
            FailedTestCases = new TestCaseGroup("Failed", testcases.Count);
            OtherTestCases  = new TestCaseGroup("Inconclusive", testcases.Count);
            testcasemap     = new Dictionary <string, TestCaseGroup>();
            foreach (TestCase testcase in testcases)
            {
                switch (testcase.Status)
                {
                case TestCaseStatus.NotRun:
                    NotRunTestCases.AddTestCase(testcase);
                    lock (locker)
                    {
                        testcasemap.Add(testcase.Name, NotRunTestCases);
                    }
                    break;

                case TestCaseStatus.Passed:
                    PassedTestCases.AddTestCase(testcase);
                    lock (locker)
                    {
                        testcasemap.Add(testcase.Name, PassedTestCases);
                    }
                    break;

                case TestCaseStatus.Failed:
                    FailedTestCases.AddTestCase(testcase);
                    lock (locker)
                    {
                        testcasemap.Add(testcase.Name, FailedTestCases);
                    }
                    break;

                case TestCaseStatus.Other:
                    OtherTestCases.AddTestCase(testcase);
                    lock (locker)
                    {
                        testcasemap.Add(testcase.Name, OtherTestCases);
                    }
                    break;

                case TestCaseStatus.Running:
                    RunningTestCase = testcase;
                    break;
                }
            }
            groupList = null;
        }
コード例 #5
0
 public void SetTestCaseList(List<TestCase> testcases)
 {
     NotRunTestCases = new TestCaseGroup("Not Run", testcases.Count);
     PassedTestCases = new TestCaseGroup("Passed", testcases.Count);
     FailedTestCases = new TestCaseGroup("Failed", testcases.Count);
     OtherTestCases = new TestCaseGroup("Inconclusive", testcases.Count);
     testcasemap = new Dictionary<string, TestCaseGroup>();
     foreach (TestCase testcase in testcases)
     {
         switch (testcase.Status)
         {
             case TestCaseStatus.NotRun:
                 NotRunTestCases.AddTestCase(testcase);
                 testcasemap.Add(testcase.Name, NotRunTestCases);
                 break;
             case TestCaseStatus.Passed:
                 PassedTestCases.AddTestCase(testcase);
                 testcasemap.Add(testcase.Name, PassedTestCases);
                 break;
             case TestCaseStatus.Failed:
                 FailedTestCases.AddTestCase(testcase);
                 testcasemap.Add(testcase.Name, FailedTestCases);
                 break;
             case TestCaseStatus.Other:
                 OtherTestCases.AddTestCase(testcase);
                 testcasemap.Add(testcase.Name, OtherTestCases);
                 break;
             case TestCaseStatus.Running:
                 RunningTestCase = testcase;
                 break;
         }
     }
     groupList = null;
 }
コード例 #6
0
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to   = OtherTestCases;

            if (from == null)
            {
                return;
            }
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);

            // If changed to Running/Waiting status, no need to change group.
            lock (locker)
            {
                if (status == TestCaseStatus.Running)
                {
                    if (RunningTestCase != null)
                    {
                        if (RunningTestCase.Status == TestCaseStatus.Running)
                        {
                            RunningTestCase.Status = TestCaseStatus.Waiting;
                        }
                    }
                    RunningTestCase        = testcase;
                    RunningTestCase.Status = status;
                    if (UpdateTestCaseList != null)
                    {
                        UpdateTestCaseList(from, RunningTestCase);
                    }
                    return;
                }
                if (status == TestCaseStatus.Waiting)
                {
                    if (testcase.Status == TestCaseStatus.Running)
                    {
                        testcase.Status = status;
                        return;
                    }
                }

                switch (status)
                {
                case TestCaseStatus.Passed:
                    testcase.IsChecked = false;
                    to = PassedTestCases;
                    break;

                case TestCaseStatus.Failed:
                    testcase.IsChecked = true;
                    to = FailedTestCases;
                    break;

                case TestCaseStatus.Other:
                    to = OtherTestCases;
                    break;

                case TestCaseStatus.NotRun:
                    to = NotRunTestCases;
                    break;
                }
                testcase.Status = status;
                if (UpdateTestCaseStatus != null)
                {
                    UpdateTestCaseStatus(from, to, testcase);
                }
                else
                {
                    from.RemoveTestCase(testcase);
                    to.AddTestCase(testcase);
                }
                testcasemap[testCaseName] = to;
            }
        }