Exemplo n.º 1
0
        public void ServerTimeoutTest()
        {
            // Delay after loading the test
            Thread.Sleep(timeout);

            // Copy all the tests from the remote domain
            // to verify that Test object is connected.
            UITestNode node = new UITestNode(test, true);

            // Run the tests, which also verifies that
            // RemoteTestRunner has not been disconnected
            TestResult result = domain.Run(NullListener.NULL);

            // Delay again to let the results "ripen"
            Thread.Sleep(timeout);

            // Visit the results of the test after another delay
            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(5, summarizer.ResultCount);
            Assert.AreEqual(2, summarizer.TestsNotRun);

            // Make sure we can still access the tests
            // using the Test property of the result
            node = new UITestNode(result.Test, true);
        }
Exemplo n.º 2
0
        public RemoteTestResult GetLocalTestResult(TestResult t)
        {
            RemoteTestResult res = new RemoteTestResult();
            var summary          = new ResultSummarizer(t);

            res.Failures     = summary.Failures;
            res.Errors       = summary.Errors;
            res.Ignored      = summary.Ignored;
            res.Inconclusive = summary.Inconclusive;
            res.NotRunnable  = summary.NotRunnable;
            res.Passed       = summary.Passed;
            res.StackTrace   = t.StackTrace;
            res.Time         = TimeSpan.FromSeconds(t.Time);
            res.Message      = t.Message;

            if (consoleOutput != null)
            {
                res.ConsoleOutput = consoleOutput.ToString();
                res.ConsoleError  = consoleError.ToString();
                consoleOutput     = null;
                consoleError      = null;
            }

            return(res);
        }
Exemplo n.º 3
0
        public void RerunFixtureAfterSetUpFixed()
        {
            MisbehavingFixture fixture = new MisbehavingFixture();

            fixture.blowUpInSetUp = true;
            TestSuiteResult result = RunTestOnFixture(fixture);

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);
            Assert.IsTrue(result.Executed, "Suite should have executed");

            //fix the blow up in setup
            fixture.Reinitialize();
            result = RunTestOnFixture(fixture);

            Assert.AreEqual(1, fixture.setUpCount, "setUpCount");
            Assert.AreEqual(1, fixture.tearDownCount, "tearDownCOunt");

            // should have one suite and one fixture
            summ = new ResultSummarizer(result);
            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);
        }
Exemplo n.º 4
0
        public void HandleErrorInFixtureSetup()
        {
            MisbehavingFixture fixture = new MisbehavingFixture();

            fixture.blowUpInSetUp = true;
            TestSuiteResult result = (TestSuiteResult)RunTestOnFixture(fixture);

            Assert.AreEqual(1, fixture.setUpCount, "setUpCount");
            Assert.AreEqual(0, fixture.tearDownCount, "tearDownCOunt");

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);

            Assert.IsTrue(result.Executed, "Suite should have executed");
            Assert.IsTrue(result.IsFailure, "Suite should have failed");
            Assert.AreEqual("System.Exception : This was thrown from fixture setup", result.Message, "TestSuite Message");
            Assert.IsNotNull(result.StackTrace, "TestSuite StackTrace should not be null");

            TestResult testResult = ((TestResult)result.Results[0]);

            Assert.IsTrue(testResult.Executed, "Testcase should have executed");
            Assert.AreEqual("TestFixtureSetUp failed in MisbehavingFixture", testResult.Message, "TestSuite Message");
            Assert.AreEqual(FailureSite.Parent, testResult.FailureSite);
            Assert.AreEqual(testResult.StackTrace, testResult.StackTrace, "TestCase stackTrace should match TestSuite stackTrace");
        }
Exemplo n.º 5
0
        public void HandleErrorInFixtureSetup()
        {
            MisbehavingFixtureSetUp testFixture = new MisbehavingFixtureSetUp();
            TestSuite suite = new TestSuite("ASuite");

            suite.Add(testFixture);
            TestSuiteResult result = (TestSuiteResult)suite.Run(NullListener.NULL);

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);

            TestSuiteResult failedResult = ((TestSuiteResult)result.Results[0]);

            Assert.IsTrue(failedResult.Executed, "Suite should have executed");
            Assert.IsTrue(failedResult.IsFailure, "Suite should have failed");
            Assert.AreEqual("This was thrown from fixture setup", failedResult.Message, "TestSuite Message");
            Assert.IsNotNull(failedResult.StackTrace, "TestSuite StackTrace should not be null");

            TestResult testResult = ((TestResult)failedResult.Results[0]);

            Assert.IsTrue(testResult.Executed, "Testcase should have executed");
            Assert.AreEqual("This was thrown from fixture setup", testResult.Message, "TestCase Message");
            Assert.AreEqual(testResult.StackTrace, testResult.StackTrace, "TestCase stackTrace should match TestSuite stackTrace");
        }
Exemplo n.º 6
0
        public void RerunFixtureAfterTearDownFixed()
        {
            MisbehavingFixture fixture = new MisbehavingFixture();

            fixture.blowUpInTearDown = true;
            TestSuiteResult result = RunTestOnFixture(fixture);

            Assert.AreEqual(1, result.Results.Count);

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);

            fixture.Reinitialize();
            result = RunTestOnFixture(fixture);

            Assert.AreEqual(1, fixture.setUpCount, "setUpCount");
            Assert.AreEqual(1, fixture.tearDownCount, "tearDownCOunt");

            summ = new ResultSummarizer(result);
            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);
        }
Exemplo n.º 7
0
        public void RerunFixtureAfterSetUpFixed()
        {
            MisbehavingFixtureSetUp testFixture = new MisbehavingFixtureSetUp();
            TestSuite suite = new TestSuite("ASuite");

            suite.Add(testFixture);
            TestSuiteResult result = (TestSuiteResult)suite.Run(NullListener.NULL);

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);
            TestResult failedResult = ((TestResult)result.Results[0]);

            Assert.IsTrue(failedResult.Executed, "Suite should have executed");

            //fix the blow up in setup
            testFixture.blowUp = false;
            result             = (TestSuiteResult)suite.Run(NullListener.NULL);

            // should have one suite and one fixture
            summ = new ResultSummarizer(result);
            Assert.AreEqual(1, summ.ResultCount);
            Assert.AreEqual(0, summ.TestsNotRun);
            Assert.AreEqual(0, summ.SuitesNotRun);
        }
Exemplo n.º 8
0
        public void HandleIgnoreInFixtureSetup()
        {
            IgnoreInFixtureSetUp testFixture = new IgnoreInFixtureSetUp();
            TestSuite            suite       = new TestSuite("ASuite");

            suite.Add(testFixture);
            TestSuiteResult result = (TestSuiteResult)suite.Run(NullListener.NULL);

            // should have one suite and one fixture
            ResultSummarizer summ = new ResultSummarizer(result);

            Assert.AreEqual(0, summ.ResultCount);
            Assert.AreEqual(1, summ.TestsNotRun);
            Assert.AreEqual(1, summ.SuitesNotRun);
            TestSuiteResult ignoredResult = ((TestSuiteResult)result.Results[0]);

            Assert.IsFalse(ignoredResult.Executed, "Suite should not have executed");
            Assert.AreEqual("TestFixtureSetUp called Ignore", ignoredResult.Message);
            Assert.IsNotNull(ignoredResult.StackTrace, "StackTrace should not be null");

            TestResult testResult = ((TestResult)ignoredResult.Results[0]);

            Assert.IsFalse(testResult.Executed, "Testcase should not have executed");
            Assert.AreEqual("TestFixtureSetUp called Ignore", testResult.Message);
        }
        public void ReportResults()
        {
            var summary = new ResultSummarizer(_result);

            WriteSummaryReport(summary);

            bool hasErrors = summary.Errors > 0 || summary.Failures > 0 || _result.IsError || _result.IsFailure;

            if (_options.stoponerror && (hasErrors || summary.NotRunnable > 0))
            {
                Console.WriteLine("Test run was stopped after first error, as requested.");
                Console.WriteLine();
            }

            if (hasErrors)
            {
                WriteErrorsAndFailuresReport(_result);
            }

            if (summary.TestsNotRun > 0)
            {
                WriteNotRunReport(_result);
            }

            if (_options.compatibility)
            {
                WriteCompatibilityReport(_options);
            }
        }
Exemplo n.º 10
0
        public void RunAssembly()
        {
            runner.Load(package1);
            TestResult       result  = runner.Run(NullListener.NULL, TestFilter.Empty, false, LoggingThreshold.Off);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, summary.TestsRun);
        }
Exemplo n.º 11
0
        public void ExcludingCategoryDoesNotRunExplicitTestCases()
        {
            TestFilter       filter     = new NotFilter(new CategoryFilter("MockCategory"));
            TestResult       result     = mockTestFixture.Run(NullListener.NULL, filter);
            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(2, summarizer.ResultCount);
        }
Exemplo n.º 12
0
		public void RunMultipleAssemblies()
		{
			TestResult result = domain.Run(NullListener.NULL);
			ResultSummarizer summary = new ResultSummarizer(result);
			Assert.AreEqual(
				NoNamespaceTestFixture.Tests + MockAssembly.TestsRun, 
				summary.TestsRun);
		}
Exemplo n.º 13
0
        public void RunAssembly()
        {
            runner.Load(package1);
            TestResult       result  = runner.Run(NullListener.NULL);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, summary.TestsRun);
        }
Exemplo n.º 14
0
 public void RunMultipleAssemblies()
 {
     TestResult result = domain.Run(NullListener.NULL);
     ResultSummarizer summary = new ResultSummarizer(result);
     Assert.AreEqual(
         NoNamespaceTestFixture.Tests + MockAssembly.TestsRun,
         summary.TestsRun);
 }
Exemplo n.º 15
0
        public void RunAssembly()
        {
            runner.Load(new TestPackage(mockDll));
            TestResult       result  = runner.Run(NullListener.NULL);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, summary.ResultCount);
        }
		public void RunMultipleAssemblies()
		{
			TestResult result = domain.Run(NullListener.NULL, TestFilter.Empty, false, LoggingThreshold.Off);
			ResultSummarizer summary = new ResultSummarizer(result);
			Assert.AreEqual(
				NoNamespaceTestFixture.Tests + MockAssembly.TestsRun, 
				summary.TestsRun);
		}
Exemplo n.º 17
0
        public void RunExplicitTestByCategory()
        {
            CategoryFilter   filter     = new CategoryFilter("Special");
            TestResult       result     = mockTestFixture.Run(NullListener.NULL, filter);
            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(1, summarizer.TestsRun);
        }
Exemplo n.º 18
0
        public void Failure()
        {
            ResultSummarizer summary = new ResultSummarizer(MockSuiteResult("Base", true));

            Assert.IsFalse(summary.Success);
            Assert.AreEqual(2, summary.ResultCount);
            Assert.AreEqual(1, summary.Failures);
            Assert.AreEqual(1, summary.TestsNotRun);
        }
Exemplo n.º 19
0
        public void Failure()
        {
            ResultSummarizer summary = new ResultSummarizer(MockSuiteResult("Base", true));

            Assert.IsFalse(summary.Success);
            Assert.AreEqual(2, summary.ResultCount);
            Assert.AreEqual(1, summary.FailureCount);
            Assert.AreEqual(1, summary.TestsNotRun);
        }
        public void RunMultipleAssemblies()
        {
            TestResult       result  = domain.Run(NullListener.NULL, TestFilter.Empty, false, LoggingThreshold.Off);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(
                NoNamespaceTestFixture.Tests + MockAssembly.TestsRun,
                summary.TestsRun);
        }
Exemplo n.º 21
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");
 }
Exemplo n.º 22
0
        public void ExcludingCategoryDoesNotRunExplicitTestFixtures()
        {
            TestFilter          filter     = new NotFilter(new CategoryFilter("MockCategory"));
            TestAssemblyBuilder builder    = new TestAssemblyBuilder();
            TestSuite           suite      = builder.Build("mock-assembly.dll", true);
            TestResult          result     = suite.Run(NullListener.NULL, filter);
            ResultSummarizer    summarizer = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun - 2, summarizer.ResultCount);
        }
Exemplo n.º 23
0
        public void CanRunMockAssemblyTests()
        {
            TestResult result = testDomain.Run( NullListener.NULL );
            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.IsFailure, "Test run failed");

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, summarizer.ResultCount);
            Assert.AreEqual(MockAssembly.Ignored, summarizer.TestsNotRun);
        }
Exemplo n.º 24
0
 private static void WriteSummaryReport(ResultSummarizer summary)
 {
     Console.WriteLine(
         "Tests run: {0}, Errors: {1}, Failures: {2}, Inconclusive: {3}, Time: {4} seconds",
         summary.TestsRun, summary.Errors, summary.Failures, summary.Inconclusive, summary.Time);
     Console.WriteLine(
         "  Not run: {0}, Invalid: {1}, Ignored: {2}, Skipped: {3}",
         summary.TestsNotRun, summary.NotRunnable, summary.Ignored, summary.Skipped);
     Console.WriteLine();
 }
Exemplo n.º 25
0
        public void RunMultipleAssemblies()
        {
            runner.Load(package2);
            TestResult       result  = runner.Run(NullListener.NULL);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(
                NoNamespaceTestFixture.Tests + MockAssembly.Tests - MockAssembly.NotRun,
                summary.TestsRun);
        }
        public void RunMultipleAssemblies()
        {
            Test             suite   = domain.Load(name, assemblies);
            TestResult       result  = suite.Run(NullListener.NULL);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(
                NoNamespaceTestFixture.Tests + MockAssembly.Tests - MockAssembly.NotRun,
                summary.ResultCount);
        }
Exemplo n.º 27
0
        public void ExcludingCategoryDoesNotRunExplicitTestCases()
        {
            NotFilter filter = new NotFilter(new CategoryFilter("MockCategory"));

            filter.TopLevel = true;
            TestResult       result     = mockTestFixture.Run(NullListener.NULL, filter);
            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(MockTestFixture.TestsRun - MockTestFixture.MockCategoryTests, summarizer.TestsRun);
        }
Exemplo n.º 28
0
        private void DisplayResults(TestResult[] results)
        {
            ResultSummarizer summarizer = new ResultSummarizer(results);

            int failureCount = summarizer.Failures;

            failuresPanel.Text = "Failures : " + failureCount.ToString();
            testsRunPanel.Text = "Tests Run : " + summarizer.ResultCount.ToString();
            timePanel.Text     = "Time : " + summarizer.Time.ToString();
        }
        public void AssemblySetupFixtureWrapsExecutionOfTest()
        {
            TestResult       result = runTests(null, new Filters.SimpleNameFilter("SomeTestFixture"));
            ResultSummarizer summ   = new ResultSummarizer(result);

            Assert.AreEqual(1, summ.ResultCount);
            Assert.IsTrue(result.IsSuccess);
            TestUtilities.SimpleEventRecorder.Verify("RootNamespaceSetup",
                                                     "Test",
                                                     "RootNamespaceTearDown");
        }
Exemplo n.º 30
0
        public void RunNoTestSuite()
        {
            Assert.AreEqual(0, noTestSuite.TestCount);

            TestResult result = noTestSuite.Run(NullListener.NULL, TestFilter.Empty);

            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(0, summarizer.TestsRun);
            Assert.AreEqual(0, summarizer.TestsNotRun);
        }
Exemplo n.º 31
0
        public void RunExplicitTestDirectly()
        {
            Test test = TestFinder.Find("ExplicitlyRunTest", mockTestFixture, true);

            Assert.IsNotNull(test, "Cannot find ExplicitlyRunTest");
            Assert.AreEqual(RunState.Explicit, test.RunState);
            TestResult       result     = test.Run(NullListener.NULL, TestFilter.Empty);
            ResultSummarizer summarizer = new ResultSummarizer(result);

            Assert.AreEqual(1, summarizer.TestsRun);
        }
Exemplo n.º 32
0
        public void TotalCountSuccess()
        {
            string suiteName = "Base";
            ResultSummarizer summary = new ResultSummarizer(MockSuiteResult(suiteName, false));

            Assert.AreEqual(suiteName, summary.Name);
            Assert.IsTrue(summary.Success);
            Assert.AreEqual(2, summary.ResultCount);
            Assert.AreEqual(0, summary.FailureCount);
            Assert.AreEqual(1, summary.TestsNotRun);
        }
Exemplo n.º 33
0
        public void RunMultipleAssemblies()
        {
            assemblies[0] = "nonamespace-assembly.dll";
            Test             test    = runner.Load("TestSuite", assemblies);
            TestResult       result  = runner.Run(NullListener.NULL);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(
                NoNamespaceTestFixture.Tests + MockAssembly.Tests - MockAssembly.NotRun,
                summary.ResultCount);
        }
Exemplo n.º 34
0
        public void RunAssemblyUsingBeginAndEndRun()
        {
            runner.Load(package1);
            runner.BeginRun(NullListener.NULL);
            TestResult result = runner.EndRun();

            Assert.IsNotNull(result);
            ResultSummarizer summary = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, summary.TestsRun);
        }
Exemplo n.º 35
0
        public void CanRunMockAssemblyTests()
        {
            TestResult result = testDomain.Run( NullListener.NULL );
            Assert.IsNotNull(result);

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(MockAssembly.TestsRun, summarizer.TestsRun, "TestsRun");
            Assert.AreEqual(MockAssembly.Ignored, summarizer.Ignored, "Ignored");
            Assert.AreEqual(MockAssembly.Errors, summarizer.Errors, "Errors");
            Assert.AreEqual(MockAssembly.Failures, summarizer.Failures, "Failures");
        }
Exemplo n.º 36
0
        public void TotalCountSuccess()
        {
            string           suiteName = "Base";
            ResultSummarizer summary   = new ResultSummarizer(MockSuiteResult(suiteName, false));

            Assert.AreEqual(suiteName, summary.Name);
            Assert.IsTrue(summary.Success);
            Assert.AreEqual(2, summary.ResultCount);
            Assert.AreEqual(0, summary.Failures);
            Assert.AreEqual(1, summary.TestsNotRun);
        }
Exemplo n.º 37
0
        public void ExcludingCategoryDoesNotRunExplicitTestFixtures()
        {
            NotFilter filter = new NotFilter(new CategoryFilter("MockCategory"));

            filter.TopLevel = true;
            TestAssemblyBuilder builder    = new TestAssemblyBuilder();
            TestSuite           suite      = builder.Build(MockAssembly.AssemblyPath, true, false);
            TestResult          result     = suite.Run(NullListener.NULL, filter);
            ResultSummarizer    summarizer = new ResultSummarizer(result);

            Assert.AreEqual(MockAssembly.TestsRun - 2, summarizer.TestsRun);
        }
		public void SummaryMatchesResult()
		{
			ResultSummarizer summary = new ResultSummarizer( result );

			Assert.AreEqual(result.Name, summary.Name);
			Assert.AreEqual(result.Time, summary.Time);
			Assert.AreEqual(result.IsSuccess, summary.Success, "Success");
        
            Assert.AreEqual(MockTestFixture.ResultCount, summary.ResultCount );
			Assert.AreEqual(MockTestFixture.TestsRun, summary.TestsRun, "TestsRun");
			Assert.AreEqual(MockTestFixture.Failures, summary.Failures, "Failures");
            Assert.AreEqual(MockTestFixture.Errors, summary.Errors, "Errors");
			Assert.AreEqual(MockTestFixture.Ignored, summary.Ignored, "Ignored");
            Assert.AreEqual(MockTestFixture.NotRunnable, summary.NotRunnable, "NotRunnable");
		}
		public void SpecificTestFixture()
		{
			TestPackage package = new TestPackage(mockDll);
			package.TestName = "NUnit.Tests.Assemblies.MockTestFixture";
			testDomain.Load( package );

			TestResult result = testDomain.Run( NullListener.NULL, TestFilter.Empty, false, LoggingThreshold.Off );

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(MockTestFixture.TestsRun, summarizer.TestsRun, "TestsRun");
            Assert.AreEqual(MockTestFixture.Ignored, summarizer.Ignored, "Ignored");
            Assert.AreEqual(MockTestFixture.Errors, summarizer.Errors, "Errors");
            Assert.AreEqual(MockTestFixture.Failures, summarizer.Failures, "Failures");
        }
Exemplo n.º 40
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);
 }
Exemplo n.º 41
0
        public void SpecificTestFixture()
        {
            TestPackage package = new TestPackage( "mock-assembly.dll" );
            package.TestName = "NUnit.Tests.Assemblies.MockTestFixture";
            testDomain.Load( package );

            TestResult result = testDomain.Run( NullListener.NULL );

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(MockTestFixture.TestsRun, summarizer.TestsRun, "TestsRun");
            Assert.AreEqual(MockTestFixture.Ignored, summarizer.Ignored, "Ignored");
            Assert.AreEqual(MockTestFixture.Errors, summarizer.Errors, "Errors");
            Assert.AreEqual(MockTestFixture.Failures, summarizer.Failures, "Failures");
        }
Exemplo n.º 42
0
 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");
 }
Exemplo n.º 43
0
        public void SpecificTestFixture()
        {
            TestPackage package = new TestPackage( "mock-assembly.dll" );
            package.TestName = "NUnit.Tests.Assemblies.MockTestFixture";
            testDomain.Load( package );

            TestResult result = testDomain.Run( NullListener.NULL );
            Assert.AreEqual(true, result.IsSuccess);

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(MockTestFixture.Tests - MockTestFixture.NotRun, summarizer.ResultCount);
            Assert.AreEqual(MockTestFixture.Ignored, summarizer.TestsNotRun);
        }
Exemplo n.º 44
0
 public void TestTime()
 {
     ResultSummarizer summary = new ResultSummarizer(MockSuiteResult("Base", false));
     Assert.AreEqual(time, summary.Time);
 }
Exemplo n.º 45
0
 public void TestCountNotRunSuites()
 {
     ResultSummarizer summary = new ResultSummarizer(NotRunTestSuite());
     Assert.AreEqual(1,summary.TestsNotRun);
 }