Exemplo n.º 1
0
        public void TestFinished(ITestResultAdaptor test)
        {
            if (TestRunnerWindow.s_Instance == null)
            {
                return;
            }

            var result = new TestRunnerResult(test);

            TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateResult(result);
        }
        public void TestFinished(ITestResultAdaptor test)
        {
            var result = new TestRunnerResult(test);

            if (TestRunnerWindow.s_Instance == null)
            {
                WindowResultUpdaterDataHolder.instance.CachedResults.Add(result);
                return;
            }

            TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateResult(result);
        }
Exemplo n.º 3
0
        public void Summarize(TestRunnerResult result)
        {
            m_Duration += TimeSpan.FromSeconds(result.duration);
            m_ResultCount++;

            if (result.resultStatus != TestRunnerResult.ResultStatus.NotRun)
            {
                //TODO implement missing features
                //                if(result.IsIgnored)
                //                {
                //                    m_IgnoreCount++;
                //                    return;
                //                }

                m_SkipCount++;
                return;
            }

            switch (result.resultStatus)
            {
            case TestRunnerResult.ResultStatus.Passed:
                m_SuccessCount++;
                m_TestsRun++;
                break;

            case TestRunnerResult.ResultStatus.Failed:
                m_FailureCount++;
                m_TestsRun++;
                break;

            //TODO implement missing features
            //                case TestResultState.Error:
            //                case TestResultState.Cancelled:
            //                    m_ErrorCount++;
            //                    m_TestsRun++;
            //                    break;
            //                case TestResultState.Inconclusive:
            //                    m_InconclusiveCount++;
            //                    m_TestsRun++;
            //                    break;
            //                case TestResultState.NotRunnable:
            //                    m_NotRunnable++;
            //                    // errorCount++;
            //                    break;
            //                case TestResultState.Ignored:
            //                    m_IgnoreCount++;
            //                    break;
            default:
                m_SkipCount++;
                break;
            }
        }
Exemplo n.º 4
0
        public void UpdateResult(TestRunnerResult result)
        {
            if (!HasTreeData())
            {
                m_QueuedResults.Add(result);
                return;
            }

            if (ResultsByKey.TryGetValue(result.uniqueId, out var testRunnerResult))
            {
                testRunnerResult.Update(result);
                Repaint();
                m_Window.Repaint();
            }
        }
 private bool IsFilteredOutByUIFilter(ITestAdaptor test, TestRunnerResult result)
 {
     if (m_UIFilter.PassedHidden && result.resultStatus == TestRunnerResult.ResultStatus.Passed)
     {
         return(true);
     }
     if (m_UIFilter.FailedHidden && (result.resultStatus == TestRunnerResult.ResultStatus.Failed || result.resultStatus == TestRunnerResult.ResultStatus.Inconclusive))
     {
         return(true);
     }
     if (m_UIFilter.NotRunHidden && (result.resultStatus == TestRunnerResult.ResultStatus.NotRun || result.resultStatus == TestRunnerResult.ResultStatus.Skipped))
     {
         return(true);
     }
     if (m_UIFilter.CategoryFilter.Length > 0)
     {
         return(!test.Categories.Any(category => m_UIFilter.CategoryFilter.Contains(category)));
     }
     return(false);
 }
 public void Update(TestRunnerResult result)
 {
     if (ReferenceEquals(result, null))
     {
         return;
     }
     resultStatus     = result.resultStatus;
     duration         = result.duration;
     messages         = result.messages;
     output           = result.output;
     stacktrace       = result.stacktrace;
     ignoredOrSkipped = result.ignoredOrSkipped;
     notRunnable      = result.notRunnable;
     description      = result.description;
     notOutdated      = result.notOutdated;
     if (m_OnResultUpdate != null)
     {
         m_OnResultUpdate(this);
     }
 }
Exemplo n.º 7
0
        public void UpdateResult(TestRunnerResult result)
        {
            if (!HasTreeData())
            {
                m_QueuedResults.Add(result);
                return;
            }

            if (newResultList.All(x => x.uniqueId != result.uniqueId))
            {
                return;
            }

            var testRunnerResult = newResultList.FirstOrDefault(x => x.uniqueId == result.uniqueId);

            if (testRunnerResult != null)
            {
                testRunnerResult.Update(result);
            }

            Repaint();
            m_Window.Repaint();
        }
Exemplo n.º 8
0
        private void ResultUpdated(TestRunnerResult testResult)
        {
            switch (testResult.resultStatus)
            {
            case TestRunnerResult.ResultStatus.Passed:
                icon = Icons.s_SuccessImg;
                break;

            case TestRunnerResult.ResultStatus.Failed:
                icon = Icons.s_FailImg;
                break;

            case TestRunnerResult.ResultStatus.Inconclusive:
                icon = Icons.s_InconclusiveImg;
                break;

            case TestRunnerResult.ResultStatus.Skipped:
                icon = Icons.s_IgnoreImg;
                break;

            default:
                if (testResult.ignoredOrSkipped)
                {
                    icon = Icons.s_IgnoreImg;
                }
                else if (testResult.notRunnable)
                {
                    icon = Icons.s_FailImg;
                }
                else
                {
                    icon = Icons.s_UnknownImg;
                }
                break;
            }
        }
        private void ParseTestTree(int depth, TreeViewItem rootItem, ITestAdaptor testElement)
        {
            m_AvailableCategories.AddRange(testElement.Categories);

            var testElementId = testElement.UniqueName;

            if (!testElement.HasChildren)
            {
                var result = m_OldTestResultList.FirstOrDefault(a => a.uniqueId == testElementId);

                if (result != null &&
                    (result.ignoredOrSkipped ||
                     result.notRunnable ||
                     testElement.RunState == RunState.NotRunnable ||
                     testElement.RunState == RunState.Ignored ||
                     testElement.RunState == RunState.Skipped
                    )
                    )
                {
                    //if the test was or becomes ignored or not runnable, we recreate the result in case it has changed
                    result = null;
                }
                if (result == null)
                {
                    result = new TestRunnerResult(testElement);
                }
                results.Add(result);

                var test = new TestTreeViewItem(testElement, depth, rootItem);
                if (!IsFilteredOutByUIFilter(testElement, result))
                {
                    rootItem.AddChild(test);
                }
                test.SetResult(result);
                return;
            }

            var groupResult = m_OldTestResultList.FirstOrDefault(a => a.uniqueId == testElementId);

            if (groupResult == null)
            {
                groupResult = new TestRunnerResult(testElement);
            }

            results.Add(groupResult);
            var group = new TestTreeViewItem(testElement, depth, rootItem);

            group.SetResult(groupResult);

            depth++;
            foreach (var child in testElement.Children)
            {
                ParseTestTree(depth, group, child);
            }


            if (testElement.IsTestAssembly && !testElement.HasChildren)
            {
                return;
            }

            if (group.hasChildren)
            {
                rootItem.AddChild(group);
            }
        }
Exemplo n.º 10
0
 public void SetResult(TestRunnerResult testResult)
 {
     result = testResult;
     result.SetResultChangedCallback(ResultUpdated);
     ResultUpdated(result);
 }