当前位置: 首页>>代码示例>>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;未经允许,请勿转载。