Пример #1
0
 internal override void FindRegressions(UnitTestCollection list, DateTime fromDate, DateTime toDate)
 {
     foreach (UnitTest test in Tests)
     {
         test.FindRegressions(list, fromDate, toDate);
     }
 }
Пример #2
0
        public UnitTestCollection GetFailedTests(DateTime date)
        {
            UnitTestCollection col = new UnitTestCollection();

            CollectFailedTests(col, date);
            return(col);
        }
Пример #3
0
        public UnitTestCollection GetRegressions(DateTime fromDate, DateTime toDate)
        {
            UnitTestCollection list = new UnitTestCollection();

            FindRegressions(list, fromDate, toDate);
            return(list);
        }
Пример #4
0
        internal virtual void FindRegressions(UnitTestCollection list, DateTime fromDate, DateTime toDate)
        {
            UnitTestResult res1 = Results.GetLastResult(fromDate);
            UnitTestResult res2 = Results.GetLastResult(toDate);

            if ((res1 == null || res1.IsSuccess) && (res2 != null && !res2.IsSuccess))
            {
                list.Add(this);
            }
        }
Пример #5
0
 public void UpdateTests()
 {
     if (tests != null)
     {
         foreach (UnitTest t in tests)
         {
             t.Dispose();
         }
         tests = null;
         OnTestChanged();
     }
 }
Пример #6
0
        static UnitTestResult GenerateResultFromTests(UnitTestCollection tests, out bool isHistoric)
        {
            int passed      = 0;
            int errors      = 0;
            int failures    = 0;
            int skipped     = 0;
            int uniqueCount = 0;

            isHistoric = false;
            ResultStatus?lastStatus   = null;
            var          resultStatus = ResultStatus.Inconclusive;

            foreach (var test in tests)
            {
                var res = test?.GetLastResult();
                if (res == null)
                {
                    continue;
                }
                passed   += res.Passed;
                errors   += res.Errors;
                failures += res.Failures;
                skipped  += res.Skipped;

                if (res.Status != lastStatus)
                {
                    uniqueCount++;
                }

                lastStatus  = res.Status;
                isHistoric |= test.IsHistoricResult;
            }

            if (uniqueCount == 1)
            {
                resultStatus = lastStatus.Value;
            }

            var result = new UnitTestResult()
            {
                Status   = resultStatus,
                Passed   = passed,
                Errors   = errors,
                Skipped  = skipped,
                Failures = failures
            };

            return(result);
        }
Пример #7
0
 void CollectFailedTests(UnitTestCollection col, DateTime date)
 {
     foreach (UnitTest t in Tests)
     {
         if (t is UnitTestGroup)
         {
             ((UnitTestGroup)t).CollectFailedTests(col, date);
         }
         else
         {
             UnitTestResult res = t.Results.GetLastResult(date);
             if (res != null && res.IsFailure)
             {
                 col.Add(t);
             }
         }
     }
 }
Пример #8
0
        void FillTestInformation()
        {
            if (!detailsPad.Visible)
            {
                return;
            }

            if (detailsTest is UnitTestGroup)
            {
                UnitTestGroup group = detailsTest as UnitTestGroup;
                if (infoBook.Page == TestSummaryPage)
                {
                    detailsStore.Clear();
                    foreach (UnitTest t in group.Tests)
                    {
                        UnitTestResult res = t.Results.GetLastResult(chart.CurrentDate);
                        if (res != null)
                        {
                            detailsStore.AppendValues(t, t.Name, res.Passed.ToString(), res.ErrorsAndFailures.ToString(), res.Ignored.ToString());
                        }
                        else
                        {
                            detailsStore.AppendValues(t, t.Name, "", "", "");
                        }
                    }
                }
                else if (infoBook.Page == TestRegressionsPage)
                {
                    regressionStore.Clear();
                    UnitTestCollection regs = detailsTest.GetRegressions(chart.ReferenceDate, chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            regressionStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        regressionStore.AppendValues(null, GettextCatalog.GetString("No regressions found."));
                    }
                }
                else if (infoBook.Page == TestFailuresPage)
                {
                    failedStore.Clear();
                    UnitTestCollection regs = group.GetFailedTests(chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            failedStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        failedStore.AppendValues(null, GettextCatalog.GetString("No failed tests found."));
                    }
                }
            }
            else
            {
                UnitTestResult res = detailsTest.Results.GetLastResult(chart.CurrentDate);
                if (infoBook.Page == TestOutputPage)
                {
                    outputView.Buffer.Clear();
                    if (res != null)
                    {
                        outputView.Buffer.InsertAtCursor(res.ConsoleOutput);
                    }
                }
                else if (infoBook.Page == TestResultPage)
                {
                    resultView.Buffer.Clear();
                    if (res != null)
                    {
                        string msg = res.Message + "\n\n" + res.StackTrace;
                        resultView.Buffer.InsertAtCursor(msg);
                    }
                }
            }
        }