當前位置: 首頁>>代碼示例>>C#>>正文


C# Util.ResultSummarizer類代碼示例

本文整理匯總了C#中NUnit.Util.ResultSummarizer的典型用法代碼示例。如果您正苦於以下問題:C# ResultSummarizer類的具體用法?C# ResultSummarizer怎麽用?C# ResultSummarizer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResultSummarizer類屬於NUnit.Util命名空間,在下文中一共展示了ResultSummarizer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HandleErrorInFixtureSetup

        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" );
        }
開發者ID:taoxiease,項目名稱:asegrp,代碼行數:26,代碼來源:FixtureSetUpTearDownTest.cs

示例2: RunExplicitTestByCategory

		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 );
		}
開發者ID:Buildstarted,項目名稱:ContinuousTests,代碼行數:7,代碼來源:TestSuiteTest.cs

示例3: InitializeXmlFile

		private void InitializeXmlFile(TestResult result) 
		{
			ResultSummarizer summaryResults = new ResultSummarizer(result);

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

			xmlWriter.WriteStartElement("test-results");

			xmlWriter.WriteAttributeString("name", summaryResults.Name);
			xmlWriter.WriteAttributeString("total", summaryResults.TestsRun.ToString());
            xmlWriter.WriteAttributeString("errors", summaryResults.Errors.ToString());
            xmlWriter.WriteAttributeString("failures", summaryResults.Failures.ToString());
            xmlWriter.WriteAttributeString("not-run", summaryResults.TestsNotRun.ToString());
            xmlWriter.WriteAttributeString("inconclusive", summaryResults.Inconclusive.ToString());
            xmlWriter.WriteAttributeString("ignored", summaryResults.Ignored.ToString());
            xmlWriter.WriteAttributeString("skipped", summaryResults.Skipped.ToString());
            xmlWriter.WriteAttributeString("invalid", summaryResults.NotRunnable.ToString());

			DateTime now = DateTime.Now;
			xmlWriter.WriteAttributeString("date", XmlConvert.ToString( now, "yyyy-MM-dd" ) );
			xmlWriter.WriteAttributeString("time", XmlConvert.ToString( now, "HH:mm:ss" ));
			WriteEnvironment();
			WriteCultureInfo();
		}
開發者ID:rmterra,項目名稱:AutoTest.Net,代碼行數:26,代碼來源:XmlResultWriter.cs

示例4: RunExplicitTestDirectly

		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 );
		}
開發者ID:Buildstarted,項目名稱:ContinuousTests,代碼行數:9,代碼來源:TestSuiteTest.cs

示例5: AssemblySetupFixtureWrapsExecutionOfTest

 public void AssemblySetupFixtureWrapsExecutionOfTest()
 {
     TestResult result = runTests(null, new Filters.SimpleNameFilter("SomeTestFixture"));
     ResultSummarizer summ = new ResultSummarizer(result);
     Assert.AreEqual(1, summ.TestsRun);
     Assert.IsTrue(result.IsSuccess);
     TestUtilities.SimpleEventRecorder.Verify("RootNamespaceSetup",
                             "Test",
                           "RootNamespaceTearDown");
 }
開發者ID:danstuken,項目名稱:shouldly,代碼行數:10,代碼來源:SetUpFixtureTests.cs

示例6: RunIgnoredTestCase

        public void RunIgnoredTestCase()
        {
            Type fixtureType = typeof(MockTestFixture);
            TestCase testCase = TestBuilder.MakeTestCase( fixtureType, "MockTest4" );
            Assert.AreEqual(1, testCase.TestCount);

            TestResult result = testCase.Run(NullListener.NULL);
            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(0, summarizer.ResultCount);
            Assert.AreEqual(1, summarizer.TestsNotRun);
        }
開發者ID:taoxiease,項目名稱:asegrp,代碼行數:11,代碼來源:TestCaseTest.cs

示例7: RunTestsInFixture

		public void RunTestsInFixture()
		{
            TestResult result = mockTestFixture.Run(NullListener.NULL, TestFilter.Empty);
			ResultSummarizer summarizer = new ResultSummarizer( result );
			Assert.AreEqual( MockTestFixture.TestsRun, summarizer.TestsRun, "TestsRun" );
            Assert.AreEqual( MockTestFixture.NotRunnable, summarizer.NotRunnable, "NotRunnable");
            Assert.AreEqual(MockTestFixture.Ignored, summarizer.Ignored, "Ignored");
            Assert.AreEqual(MockTestFixture.Errors, summarizer.Errors, "Errors");
            Assert.AreEqual(MockTestFixture.Failures, summarizer.Failures, "Failures");

			result = TestFinder.Find( "ExplicitlyRunTest", result, true );
			Assert.IsNull( result, "ExplicitlyRunTest should not be in results" );

			// TODO: Decide if we want to include Explicit tests that are not run in results
			//			Assert.IsNotNull( result, "Cannot find ExplicitlyRunTest result" );
			//			Assert.IsFalse( result.Executed, "ExplicitlyRunTest should not be executed" );
			//			Assert.AreEqual( "Explicit selection required", result.Message );
		}
開發者ID:Buildstarted,項目名稱:ContinuousTests,代碼行數:18,代碼來源:TestSuiteTest.cs

示例8: LoadAndRunTestAssembly

		protected void LoadAndRunTestAssembly( fit.Parse cell, string testAssembly )
		{
			testRunner = new TestDomain();

			if ( !testRunner.Load( new TestPackage(testAssembly) ) )
			{
				this.wrong(cell);
				cell.addToBody( string.Format( 
					"<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testAssembly ) );

				return;
			}

			testResult = testRunner.Run(NullListener.NULL);
			testSummary = new ResultSummarizer( testResult );

			this.right( cell );
		}
開發者ID:nobled,項目名稱:mono,代碼行數:18,代碼來源:TestLoadFixture.cs

示例9: Initialize

		private void Initialize(TestResult result) 
		{
			ResultSummarizer summaryResults = new ResultSummarizer(result);

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

			xmlWriter.WriteStartElement("test-results");

			xmlWriter.WriteAttributeString("name", summaryResults.Name);
			xmlWriter.WriteAttributeString("total", summaryResults.ResultCount.ToString());
			xmlWriter.WriteAttributeString("failures", summaryResults.Failures.ToString());
			xmlWriter.WriteAttributeString("not-run", summaryResults.TestsNotRun.ToString());

			DateTime now = DateTime.Now;
			xmlWriter.WriteAttributeString("date", now.ToShortDateString());
			xmlWriter.WriteAttributeString("time", now.ToShortTimeString());
		}
開發者ID:alesliehughes,項目名稱:olive,代碼行數:19,代碼來源:XmlResultVisitor.cs

示例10: Execute

        public int Execute()
        {
            try
            {
                var result = RunTesterBlocking();
                var summary = new ResultSummarizer(result);

                return summary.Errors + summary.Failures + summary.NotRunnable;
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine(ex.Message);
                return ConsoleUi.FILE_NOT_FOUND;
            }
            catch (Exception ex)
            {
                //TODO need to expand on error cases better... mimic console runner
                Console.WriteLine(ex);
                return ConsoleUi.UNEXPECTED_ERROR;
            }
        }
開發者ID:uShip,項目名稱:Concord,代碼行數:21,代碼來源:InternalCategoryRunner.cs

示例11: Main

        public static int Main(string[] args)
        {
            var result = RunTests(args);

            var total = (from object r in result.Results select r as TestResult).Count();

            var results = new ResultSummarizer(result);

            Console.WriteLine(
                @"total={0} run={1} passed={2} failures={3} errors={4} not-run={5} inconclusive={6} ignored={7} skipped={8} invalid={9}",
                total,
                results.TestsRun,
                results.Passed,
                results.Failures,
                results.Errors,
                results.TestsNotRun,
                results.Inconclusive,
                results.Ignored,
                results.Skipped,
                results.NotRunnable);

            // will return "0" if no tests failed
            return results.ErrorsAndFailures;
        }
開發者ID:Ancestry,項目名稱:ParallelizeNunit,代碼行數:24,代碼來源:Program.cs

示例12: WriteSummaryReport

		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();
        }
開發者ID:rmterra,項目名稱:AutoTest.Net,代碼行數:10,代碼來源:ConsoleUi.cs

示例13: RunTestsInFixture

        public void RunTestsInFixture()
        {
            TestResult result = mockTestFixture.Run( NullListener.NULL );
            ResultSummarizer summarizer = new ResultSummarizer( result );
            Assert.AreEqual( MockTestFixture.Tests - MockTestFixture.NotRun, summarizer.ResultCount );
            Assert.AreEqual( MockTestFixture.Ignored, summarizer.TestsNotRun );

            result = TestFinder.Find( "ExplicitlyRunTest", result );
            Assert.IsNull( result, "ExplicitlyRunTest should not be in results" );

            // TODO: Decide if we want to include Explicitly run tests
            //			Assert.IsNotNull( result, "Cannot find ExplicitlyRunTest result" );
            //			Assert.IsFalse( result.Executed, "ExplicitlyRunTest should not be executed" );
            //			Assert.AreEqual( "Explicit selection required", result.Message );
        }
開發者ID:taoxiease,項目名稱:asegrp,代碼行數:15,代碼來源:TestSuiteTest.cs

示例14: RunNoTestSuite

        public void RunNoTestSuite()
        {
            Assert.AreEqual(0, noTestSuite.TestCount);

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

            ResultSummarizer summarizer = new ResultSummarizer(result);
            Assert.AreEqual(0, summarizer.ResultCount);
            Assert.AreEqual(0, summarizer.TestsNotRun);
            Assert.AreEqual(1, summarizer.SuitesNotRun);
        }
開發者ID:taoxiease,項目名稱:asegrp,代碼行數:11,代碼來源:TestSuiteTest.cs

示例15: RunExplicitTestByName

        public void RunExplicitTestByName()
        {
            Test test = TestFinder.Find( "ExplicitlyRunTest", mockTestFixture );
            Assert.IsNotNull( test, "Cannot find ExplicitlyRunTest" );
            Assert.AreEqual( RunState.Explicit, test.RunState );

            NameFilter filter = new NameFilter( test.TestName );
            TestResult result = mockTestFixture.Run( NullListener.NULL, filter );
            ResultSummarizer summarizer = new ResultSummarizer( result );
            Assert.AreEqual( 1, summarizer.ResultCount );
        }
開發者ID:taoxiease,項目名稱:asegrp,代碼行數:11,代碼來源:TestSuiteTest.cs


注:本文中的NUnit.Util.ResultSummarizer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。