Exemplo n.º 1
0
        private void InitializeXmlFile(ITestResult result)
        {
            ResultSummary summary = new ResultSummary(result);

            xmlWriter.WriteStartDocument(false);
            xmlWriter.WriteComment("This file represents the results of running a test suite");

            xmlWriter.WriteStartElement("test-results");

            xmlWriter.WriteAttributeString("name", result.FullName);
            xmlWriter.WriteAttributeString("total", summary.TestCount.ToString());
            xmlWriter.WriteAttributeString("errors", summary.ErrorCount.ToString());
            xmlWriter.WriteAttributeString("failures", summary.FailureCount.ToString());
            var notRunTotal = summary.SkipCount + summary.FailureCount + summary.InvalidCount;
            xmlWriter.WriteAttributeString("not-run", notRunTotal.ToString());
            xmlWriter.WriteAttributeString("inconclusive", summary.InconclusiveCount.ToString());
            xmlWriter.WriteAttributeString("ignored", summary.IgnoreCount.ToString());
            xmlWriter.WriteAttributeString("skipped", summary.SkipCount.ToString());
            xmlWriter.WriteAttributeString("invalid", summary.InvalidCount.ToString());

            xmlWriter.WriteAttributeString("date", result.StartTime.ToString("yyyy-MM-dd"));
            xmlWriter.WriteAttributeString("time", result.StartTime.ToString("HH:mm:ss"));
            WriteEnvironment();
            WriteCultureInfo();
        }
Exemplo n.º 2
0
        public void ReportResults(ITestResult result)
        {
            Summary = new ResultSummary(result);

            if (Summary.ExplicitCount + Summary.SkipCount + Summary.IgnoreCount > 0)
            {
                _textUI.DisplayNotRunReport(result);
            }

            if (result.ResultState.Status == TestStatus.Failed)
            {
                _textUI.DisplayErrorsAndFailuresReport(result);
            }

#if FULL
            if (_options.Full)
            {
                _textUI.PrintFullReport(_result);
            }
#endif

            _textUI.DisplayRunSettings();

            _textUI.DisplaySummaryReport(Summary);
        }
Exemplo n.º 3
0
        private void InitializeXmlFile(ITestResult result)
        {
            ResultSummary summary = new ResultSummary(result);

            xmlWriter.WriteStartDocument(false);
            xmlWriter.WriteComment("This file represents the results of running a test suite");

            xmlWriter.WriteStartElement("test-results");

            xmlWriter.WriteAttributeString("name", result.FullName);
            xmlWriter.WriteAttributeString("total", summary.TestCount.ToString());
            xmlWriter.WriteAttributeString("errors", summary.ErrorCount.ToString());
            xmlWriter.WriteAttributeString("failures", summary.FailureCount.ToString());
            var notRunTotal = summary.SkipCount + summary.FailureCount + summary.InvalidCount;

            xmlWriter.WriteAttributeString("not-run", notRunTotal.ToString());
            xmlWriter.WriteAttributeString("inconclusive", summary.InconclusiveCount.ToString());
            xmlWriter.WriteAttributeString("ignored", summary.IgnoreCount.ToString());
            xmlWriter.WriteAttributeString("skipped", summary.SkipCount.ToString());
            xmlWriter.WriteAttributeString("invalid", summary.InvalidCount.ToString());

            xmlWriter.WriteAttributeString("date", result.StartTime.ToString("yyyy-MM-dd"));
            xmlWriter.WriteAttributeString("time", result.StartTime.ToString("HH:mm:ss"));
            WriteEnvironment();
            WriteCultureInfo();
        }
Exemplo n.º 4
0
        public void DisplaySummaryReport(ResultSummary summary)
        {
            var status = summary.ResultState.Status;

            var overallResult = status.ToString();

            if (overallResult == "Skipped")
            {
                overallResult = "Warning";
            }

            _writer.WriteLine();
            _writer.WriteLine("Test Run Summary");
            WriteLabelLine("   Overall result: ", overallResult);

            WriteSummaryCount("   Tests run: ", summary.RunCount);
            WriteSummaryCount(", Passed: ", summary.PassCount);
            WriteSummaryCount(", Errors: ", summary.ErrorCount);
            WriteSummaryCount(", Failures: ", summary.FailureCount);
            WriteSummaryCount(", Inconclusive: ", summary.InconclusiveCount);
            _writer.WriteLine();

            WriteSummaryCount("     Not run: ", summary.NotRunCount);
            WriteSummaryCount(", Invalid: ", summary.InvalidCount);
            WriteSummaryCount(", Ignored: ", summary.IgnoreCount);
            WriteSummaryCount(", Explicit: ", summary.ExplicitCount);
            WriteSummaryCount(", Skipped: ", summary.SkipCount);
            _writer.WriteLine();

            WriteLabelLine("  Start time: ", summary.StartTime.ToString("u"));
            WriteLabelLine("    End time: ", summary.EndTime.ToString("u"));
            WriteLabelLine("    Duration: ", summary.Duration.ToString("0.000") + " seconds");
        }
Exemplo n.º 5
0
        public void DisplaySummaryReport(ResultSummary summary)
        {
            var status = summary.ResultState.Status;

            var overallResult = status.ToString();

            if (overallResult == "Skipped")
            {
                overallResult = "Warning";
            }

            ColorStyle overallStyle = status == TestStatus.Passed
                ? ColorStyle.Pass
                : status == TestStatus.Failed
                    ? ColorStyle.Failure
                    : status == TestStatus.Skipped
                        ? ColorStyle.Warning
                        : ColorStyle.Output;

            if (_testCreatedOutput)
            {
                SkipLine();
            }

            WriteSectionHeader("Test Run Summary");
            WriteLabelLine("  Overall result: ", overallResult, overallStyle);

            WriteSummaryCount("  Test Count: ", summary.TestCount);
            WriteSummaryCount(", Passed: ", summary.PassCount);
            WriteSummaryCount(", Failed: ", summary.FailedCount);
            WriteSummaryCount(", Inconclusive: ", summary.InconclusiveCount);
            WriteSummaryCount(", Skipped: ", summary.TotalSkipCount);
            _outWriter.WriteLine();

            if (summary.FailedCount > 0)
            {
                _outWriter.Write("    Failed Tests - ");
                WriteSummaryCount("Failures: ", summary.FailureCount);
                WriteSummaryCount(", Errors: ", summary.ErrorCount);
                WriteSummaryCount(", Invalid: ", summary.InvalidCount);
                _outWriter.WriteLine();
            }
            if (summary.TotalSkipCount > 0)
            {
                _outWriter.Write("    Skipped Tests - ");
                WriteSummaryCount("Ignored: ", summary.IgnoreCount);
                WriteSummaryCount(", Explicit: ", summary.ExplicitCount);
                WriteSummaryCount(", Other: ", summary.SkipCount);
                _outWriter.WriteLine();
            }

            WriteLabelLine("  Start time: ", summary.StartTime.ToString("u"));
            WriteLabelLine("    End time: ", summary.EndTime.ToString("u"));
            WriteLabelLine("    Duration: ", summary.Duration.ToString("0.000") + " seconds");
            SkipLine();
        }
Exemplo n.º 6
0
        public void DisplaySummaryReport(ResultSummary summary)
        {
            var status = summary.ResultState.Status;

            var overallResult = status.ToString();
            if (overallResult == "Skipped")
                overallResult = "Warning";

            ColorStyle overallStyle = status == TestStatus.Passed
                ? ColorStyle.Pass
                : status == TestStatus.Failed
                    ? ColorStyle.Failure
                    : status == TestStatus.Skipped
                        ? ColorStyle.Warning
                        : ColorStyle.Output;

            if (_testCreatedOutput)
                SkipLine();

            WriteSectionHeader("Test Run Summary");
            WriteLabelLine("  Overall result: ", overallResult, overallStyle);

            WriteSummaryCount("  Test Count: ", summary.TestCount);
            WriteSummaryCount(", Passed: ", summary.PassCount);
            WriteSummaryCount(", Failed: ", summary.FailedCount);
            WriteSummaryCount(", Inconclusive: ", summary.InconclusiveCount);
            WriteSummaryCount(", Skipped: ", summary.TotalSkipCount);
            _outWriter.WriteLine();

            if (summary.FailedCount > 0)
            {
                _outWriter.Write("    Failed Tests - "); 
                WriteSummaryCount("Failures: ", summary.FailureCount);
                WriteSummaryCount(", Errors: ", summary.ErrorCount);
                WriteSummaryCount(", Invalid: ", summary.InvalidCount);
                _outWriter.WriteLine();
            }
            if (summary.TotalSkipCount > 0)
            {
                _outWriter.Write("    Skipped Tests - "); 
                WriteSummaryCount("Ignored: ", summary.IgnoreCount);
                WriteSummaryCount(", Explicit: ", summary.ExplicitCount);
                WriteSummaryCount(", Other: ", summary.SkipCount);
                _outWriter.WriteLine();
            }

            WriteLabelLine("  Start time: ", summary.StartTime.ToString("u"));
            WriteLabelLine("    End time: ", summary.EndTime.ToString("u"));
            WriteLabelLine("    Duration: ", summary.Duration.ToString("0.000") + " seconds");
            SkipLine();
        }
Exemplo n.º 7
0
        public void ReportResults(ITestResult result)
        {
            Summary = new ResultSummary(result);

            if (Summary.ExplicitCount + Summary.SkipCount + Summary.IgnoreCount > 0)
                _textUI.DisplayNotRunReport(result);

            if (result.ResultState.Status == TestStatus.Failed)
                _textUI.DisplayErrorsAndFailuresReport(result);

#if FULL
            if (_options.Full)
                _textUI.PrintFullReport(_result);
#endif

            _textUI.DisplayRunSettings();

            _textUI.DisplaySummaryReport(Summary);
        }
Exemplo n.º 8
0
        public void DisplaySummaryReport(ResultSummary summary)
        {
            var status = summary.ResultState.Status;

            var overallResult = status.ToString();
            if (overallResult == "Skipped")
                overallResult = "Warning";

            _writer.WriteLine();
            _writer.WriteLine("Test Run Summary");
            WriteLabelLine("  Overall result: ", overallResult);

            WriteSummaryCount("  Test Count: ", summary.TestCount);
            WriteSummaryCount(", Passed: ", summary.PassCount);
            WriteSummaryCount(", Failed: ", summary.FailedCount);
            WriteSummaryCount(", Inconclusive: ", summary.InconclusiveCount);
            WriteSummaryCount(", Skipped: ", summary.TotalSkipCount);
            _writer.WriteLine();

            if (summary.FailedCount > 0)
            {
                _writer.Write("    Failed Tests - "); 
                WriteSummaryCount("Failures: ", summary.FailureCount);
                WriteSummaryCount(", Errors: ", summary.ErrorCount);
                WriteSummaryCount(", Invalid: ", summary.InvalidCount);
                _writer.WriteLine();
            }
            if (summary.TotalSkipCount > 0)
            {
                _writer.Write("    Skipped Tests - "); 
                WriteSummaryCount("Ignored: ", summary.IgnoreCount);
                WriteSummaryCount(", Explicit: ", summary.ExplicitCount);
                WriteSummaryCount(", Other: ", summary.SkipCount);
                _writer.WriteLine();
            }

            WriteLabelLine("  Start time: ", summary.StartTime.ToString("u"));
            WriteLabelLine("    End time: ", summary.EndTime.ToString("u"));
            WriteLabelLine("    Duration: ", summary.Duration.ToString("0.000") + " seconds");
        }