Пример #1
0
        private void WriteTestSuite(string resultsName, ResultSummarizer summaryResults)
        {
            Dictionary <string, string> attributes = new Dictionary <string, string> {
                {
                    "name",
                    resultsName
                },
                {
                    "type",
                    "Assembly"
                },
                {
                    "executed",
                    "True"
                },
                {
                    "result",
                    !summaryResults.success ? "Failure" : "Success"
                },
                {
                    "success",
                    !summaryResults.success ? "False" : "True"
                },
                {
                    "time",
                    summaryResults.duration.ToString("#####0.000", NumberFormatInfo.InvariantInfo)
                }
            };

            this.WriteOpeningElement("test-suite", attributes);
        }
Пример #2
0
        private void InitializeXmlFile(string resultsName, ResultSummarizer summaryResults)
        {
            this.WriteHeader();
            DateTime now = DateTime.Now;
            Dictionary <string, string> attributes = new Dictionary <string, string> {
                {
                    "name",
                    "Unity Tests"
                },
                {
                    "total",
                    summaryResults.testsRun.ToString()
                },
                {
                    "errors",
                    summaryResults.errors.ToString()
                },
                {
                    "failures",
                    summaryResults.failures.ToString()
                },
                {
                    "not-run",
                    summaryResults.testsNotRun.ToString()
                },
                {
                    "inconclusive",
                    summaryResults.inconclusive.ToString()
                },
                {
                    "ignored",
                    summaryResults.ignored.ToString()
                },
                {
                    "skipped",
                    summaryResults.skipped.ToString()
                },
                {
                    "invalid",
                    summaryResults.notRunnable.ToString()
                },
                {
                    "date",
                    now.ToString("yyyy-MM-dd")
                },
                {
                    "time",
                    now.ToString("HH:mm:ss")
                }
            };

            this.WriteOpeningElement("test-results", attributes);
            this.WriteEnvironment(this.m_Platform);
            this.WriteCultureInfo();
            this.WriteTestSuite(resultsName, summaryResults);
            this.WriteOpeningElement("results");
        }
        public void UpdateCounters(IEnumerable <ITestResult> results)
        {
            ResultSummarizer summarizer = new ResultSummarizer(results);

            this.m_SucceededBtn = new GUIContent(summarizer.passed.ToString(), Icons.s_SuccessImg, "Show tests that succeeded");
            int num2 = (summarizer.errors + summarizer.failures) + summarizer.inconclusive;

            this.m_FailedBtn = new GUIContent(num2.ToString(), Icons.s_FailImg, "Show tests that failed");
            int num3 = summarizer.ignored + summarizer.notRunnable;

            this.m_IgnoredBtn = new GUIContent(num3.ToString(), Icons.s_IgnoreImg, "Show tests that are ignored");
            int num4 = (summarizer.testsNotRun - summarizer.ignored) - summarizer.notRunnable;

            this.m_NotRunBtn = new GUIContent(num4.ToString(), Icons.s_UnknownImg, "Show tests that didn't run");
        }