Example #1
0
        IList <ErrorOccurrenceGroup> ITestViewerService.GetCurrentErrorOccurrenceGroups(int testsystemIndex, int testsuiteId)
        {
            Testsuite      testsuite = _testsuiteRepository.GetById(testsuiteId);
            IList <Result> errorResultsOfTestsuite = _resultRepository.GetErrorResultsOfTestsuite(testsystemIndex, testsuite.Browsers,
                                                                                                  testsuite.Testcases, testsuite.Languages);

            return(ErrorGrouping.GetErrorOccurrenceGroups(errorResultsOfTestsuite));
        }
Example #2
0
        IList <ErrorOccurrenceGroup> ITestViewerService.GetHistoryErrorOccurrenceGroups(int testsystemIndex, int testsuiteId, DateTime fromDate, DateTime toDate)
        {
            Testsuite             testsuite = _testsuiteRepository.GetById(testsuiteId);
            IList <HistoryResult> historyErrorResultsOfTestsuite = _historyResultRepository.GetListOfErrorHistoryResults(testsystemIndex,
                                                                                                                         testsuite.Browsers, testsuite.Testcases, testsuite.Languages, fromDate, toDate);

            return(ErrorGrouping.GetHistoryErrorOccurrenceGroups(historyErrorResultsOfTestsuite));
        }
Example #3
0
        /// <summary>
        /// Fake implementation of send email. Logs on Console that no email is sent.
        /// </summary>
        /// <param name="testJobManager">A instance of a TestJobManager.</param>
        public void Send(ITestJobManager testJobManager)
        {
            Logger.Log("Test job finished. No success-mail send. Mailing-Service is running in test configuration.");

            List <Result> results = testJobManager.WorkItems.Select(t => t.Result).Where(t => t != null && t.Error != null).ToList();
            List <ErrorOccurrenceGroup> errorOccurrenceGroups = ErrorGrouping.GetErrorOccurrenceGroups(results);

            Logger.Log(testJobManager.Passed + " passed tests. " + testJobManager.Failured + " failed tests. ErrorOccurences from GetErrorOccurrenceGroups(): " + errorOccurrenceGroups.Count);
        }
Example #4
0
        TestcaseDetailsModel ITestViewerService.GetTestcaseDetails(int testsystemIndex, int testsuiteId, int testcaseId)
        {
            Testsuite            testsuite       = _testsuiteRepository.GetById(testsuiteId);
            TestcaseDetailsModel testcaseDetails = new TestcaseDetailsModel();

            IList <Result> errorResultsOfTestsuite = _resultRepository.GetErrorResultsOfTestsuite(testsystemIndex, testsuite.Browsers, testsuite.Testcases.Where(t => t.ID == testcaseId).ToList(),
                                                                                                  testsuite.Languages);

            IList <ErrorOccurrenceGroup> errorOccurenceGroups = ErrorGrouping.GetErrorOccurrenceGroups(errorResultsOfTestsuite);

            if (errorOccurenceGroups.Any())
            {
                testcaseDetails.ErrorOccurrenceGroup = errorOccurenceGroups.First();
            }
            testcaseDetails.Testcase = _testcaseRepository.GetById(testcaseId);
            return(testcaseDetails);
        }
        /// <summary>
        /// Send the mail
        /// </summary>
        void ITestJobFinishedMail.Send(ITestJobManager testJobManager)
        {
            if (testJobManager == null)
            {
                throw new ArgumentNullException("testJobManager");
            }



            if (String.IsNullOrEmpty(testJobManager.TestJob.Tester.Mail))
            {
                return;
            }

            List <Result> results = testJobManager.WorkItems.Select(t => t.Result).Where(t => t != null && t.Error != null).ToList();
            List <ErrorOccurrenceGroup> errorOccurrenceGroups = ErrorGrouping.GetErrorOccurrenceGroups(results);

            int    percent = (100 * testJobManager.Passed) / (testJobManager.Count);
            string color;
            string resultHeader;

            if (testJobManager.Passed == testJobManager.Count)
            {
                color        = "#5cb85c";
                resultHeader = "Success";
            }
            else
            {
                color        = "#d9534f";
                resultHeader = "Failed";
            }

            string errorOccurrences = "";

            if (errorOccurrenceGroups.Count != 0)
            {
                errorOccurrences += "<h3>These tests have failed:</h3>";
            }
            foreach (ErrorOccurrenceGroup errorOccurrenceGroup in errorOccurrenceGroups)
            {
                errorOccurrences += "<div><b>" + errorOccurrenceGroup.Testcase.Name + "</b><br>(" + errorOccurrenceGroup.Testcase.Type + ")<br><ul>";

                foreach (ErrorOccurrence errorOccurrence in errorOccurrenceGroup.LstErrorOccurence)
                {
                    errorOccurrences += "<li>" + errorOccurrence.Error.Message + " (" + errorOccurrence.LstOccurence.Count + "x)</li>";
                }
                errorOccurrences += "</ul></div><br>";
            }

            String subject = testJobManager.TestJob.Testsystem.Name + ", " + testJobManager.TestJob.Name + ": " + percent + "%";
            string url     = !string.IsNullOrEmpty(RegtestingServerConfiguration.Webportal) ? "<a href=\"" + RegtestingServerConfiguration.Webportal + "/testing?testsuite=" + testJobManager.TestJob.Testsuite.ID + "&testsystem=" + testJobManager.TestJob.Testsystem.ID + "\">Show results page in browser</a>": "";
            String body    = "<html><body>" +
                             "<div style=\"background-color:" + color + " ;padding:20px;font-size:1.7em;text-align:center;color:#ffffff;\"><b>" + testJobManager.TestJob.Testsystem.Name + "</b> - " + testJobManager.TestJob.Name + ": <b>" + resultHeader + "</b></div>"
                             + "<p>"

                             + "Started by: " + testJobManager.TestJob.Tester.Name + " (" + testJobManager.TestJob.JobType + ")<br>"
                             + "Started at: " + testJobManager.TestJob.StartedAt + "<br>"
                             + testJobManager.Passed + " passed tests.<br>"
                             + testJobManager.Failured + " failed tests.<br>"
                             + url
                             + "</p><br>"
                             + errorOccurrences
                             + "</body></html>";

            SendMail(testJobManager.TestJob.Tester.Mail, subject, body, true);
            if (testJobManager.TestJob.JobType == JobType.Buildtask)
            {
                SendMail(RegtestingServerConfiguration.NotifyAutomatedTestResultsMail, subject, body, true);
            }
        }
Example #6
0
        /// <summary>
        /// Send the mail
        /// </summary>
        void ITestJobFinishedMail.Send(ITestJobManager testJobManager)
        {
            if (testJobManager == null)
            {
                throw new ArgumentNullException("testJobManager");
            }



            if (String.IsNullOrEmpty(testJobManager.TestJob.Tester.Mail))
            {
                return;
            }

            List <Result> results = testJobManager.WorkItems.Select(t => t.Result).Where(t => t != null && t.Error != null).ToList();
            List <ErrorOccurrenceGroup> errorOccurrenceGroups = ErrorGrouping.GetErrorOccurrenceGroups(results);

            string backgroundcolor;
            string bordercolor;
            string resultHeaderStatus;

            if (testJobManager.Passed == testJobManager.Count)
            {
                backgroundcolor    = "#B6DAB8";
                bordercolor        = "#5CB85C";
                resultHeaderStatus = "succeeded";
            }
            else
            {
                backgroundcolor    = "#DF8A8A";
                bordercolor        = "#D9534F";
                resultHeaderStatus = "failed";
            }
            string errorOccurrences = "";

            if (errorOccurrenceGroups.Count != 0)
            {
                errorOccurrences += "<h3>These tests have failed:</h3>";
            }
            foreach (ErrorOccurrenceGroup errorOccurrenceGroup in errorOccurrenceGroups)
            {
                errorOccurrences += "<div><b>" + errorOccurrenceGroup.Testcase.Name + "</b><br>(" + errorOccurrenceGroup.Testcase.Type + ")<br><ul>";

                foreach (ErrorOccurrence errorOccurrence in errorOccurrenceGroup.LstErrorOccurence)
                {
                    errorOccurrences += "<li>" + errorOccurrence.Error.Message + " (" + errorOccurrence.LstOccurence.Count + "x)</li>";
                }
                errorOccurrences += "</ul></div><br>";
            }

            String subject = "UI-Tests " + resultHeaderStatus + " - " + testJobManager.TestJob.Name;
            String header;

            if (!String.IsNullOrEmpty(testJobManager.TestJob.Description))
            {
                header = testJobManager.TestJob.Description.Replace(";", "<br>");
            }
            else
            {
                header = testJobManager.TestJob.Name;
            }


            string url  = !string.IsNullOrEmpty(RegtestingServerConfiguration.Webportal) ? "<a href=\"" + RegtestingServerConfiguration.Webportal + "?testjob=" + testJobManager.TestJob.ID + "\">Show results in browser</a>": "";
            String body = "<html><body>" +
                          "<div style=\"border-left: 10px solid;border-color: " + bordercolor + ";background-color: " + backgroundcolor + ";font-size:1.2em;\">" + header + "</div>"
                          + "<p>"


                          + "Started by: " + testJobManager.TestJob.Tester.Name + " (" + testJobManager.TestJob.JobType + ")<br>"
                          + "Started at: " + testJobManager.TestJob.StartedAt + "<br>"
                          + testJobManager.Passed + " passed tests.<br>"
                          + testJobManager.Failured + " failed tests.<br>"
                          + url
                          + "</p><br>"
                          + errorOccurrences
                          + "</body></html>";

            SendMail(testJobManager.TestJob.Tester.Mail, subject, body, true);
            if (testJobManager.TestJob.JobType == JobType.Buildtask)
            {
                SendMail(RegtestingServerConfiguration.NotifyAutomatedTestResultsMail, subject, body, true);
            }
        }
Example #7
0
        IList <ErrorOccurrenceGroup> ITestViewerService.GetErrorOccurrenceGroupsForTestjob(int testjobId)
        {
            IList <HistoryResult> historyErrorResultsOfTestsuite = _historyResultRepository.GetListOfErrorHistoryResults(testjobId);

            return(ErrorGrouping.GetHistoryErrorOccurrenceGroups(historyErrorResultsOfTestsuite));
        }