예제 #1
0
        public void TestsNotRunTest()
        {
            _textUI.DisplayNotRunReport(_result);

            Assert.That(Report, Is.EqualTo(
                            "Tests Not Run\n\n" +
                            "1) Ignored : NUnit.Tests.Assemblies.MockTestFixture.IgnoreTest\n" +
                            "Ignore Message\n\n" +
                            "2) Explicit : NUnit.Tests.Assemblies.MockTestFixture.ExplicitTest\n\n"));
        }
예제 #2
0
        public void TestsNotRunTest()
        {
            var expected = new string[] {
                "Tests Not Run",
                "",
                "1) Ignored : NUnit.Tests.Assemblies.MockTestFixture.MockTest4",
                "ignoring this test method for now",
                ""
            };

            _textUI.DisplayNotRunReport(_result);
            Assert.That(GetReportLines(), Is.EqualTo(expected));
        }
예제 #3
0
        public void TestsNotRunTest()
        {
            var expected = new string[] {
                "Tests Not Run",
                "",
                "1) Ignored : NUnit.Tests.Assemblies.MockTestFixture.IgnoreTest",
                "Ignore Message",
                "",
                "2) Explicit : NUnit.Tests.Assemblies.MockTestFixture.ExplicitTest",
                ""
            };

            _textUI.DisplayNotRunReport(_result);
            Assert.That(GetReportLines(), Is.EqualTo(expected));
        }
예제 #4
0
        private async Task RunTests()
        {
            try
            {
                var assemblySuite = runner.Load(assembly, new Dictionary <string, object>
                {
                    [FrameworkPackageSettings.NumberOfTestWorkers] = 0,
                    [FrameworkPackageSettings.SynchronousEvents]   = true,
                    [FrameworkPackageSettings.RunOnMainThread]     = true
                });
                var textUI = new TextUI(writer, reader: null, options: new NUnitLiteOptions("--workers=0"));
                textUI.DisplayHeader();
                textUI.DisplayTestFiles(new string[] { assembly.FullName });

                var results = new List <ITestResult>();

                foreach (var test in assemblySuite.Tests.SelectManyRecursive(suite => suite.Tests))
                {
                    if (test.HasChildren)
                    {
                        continue;
                    }

                    await Task.Delay(1); // Allow UI to respond

                    results.Add(runner.Run(new TextUIAdapterListener(textUI), new SingleTestCaseFilter(test)));
                }

                var result  = MergeTestResults(results);
                var summary = new ResultSummary(result);

                if (summary.ExplicitCount + summary.SkipCount + summary.IgnoreCount > 0)
                {
                    textUI.DisplayNotRunReport(result);
                }

                textUI.DisplayErrorsFailuresAndWarningsReport(result);
                textUI.DisplayRunSettings();
                textUI.DisplaySummaryReport(summary);

                OnTestRunEnded();
            }
            catch (Exception ex)
            {
                writer.WriteLine(ColorStyle.Error, "Unhandled runner exception: ");
                writer.WriteLine(ColorStyle.Error, ex.ToString());
            }
        }
예제 #5
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 || result.ResultState.Status == TestStatus.Warning)
            {
                _textUI.DisplayErrorsFailuresAndWarningsReport(result);
            }

            // _textUI.DisplayRunSettings();

            // _textUI.DisplaySummaryReport(Summary);

            // _textUI.Writer.WriteLine("Summary:");
            // _textUI.Writer.WriteLine();

            if (Summary.FailedCount > 0)
            {
                _textUI.Writer.WriteLine(ColorStyle.Error, "\tFAILED");
                _textUI.Writer.WriteLine();
                _textUI.Writer.WriteLine($"\t {Summary.FailedCount} tests failed");
                _textUI.Writer.WriteLine($"\t {Summary.PassCount} tests passed");
            }
            else
            {
                _textUI.Writer.WriteLine(ColorStyle.Pass, "\tPASSED");
                _textUI.Writer.WriteLine();
            }

            _textUI.Writer.WriteLine($"\tTotal of {Summary.TestCount} tests run in {Summary.Duration:F0}s");
            _textUI.Writer.WriteLine();
        }