当前位置: 首页>>代码示例>>C#>>正文


C# ITestListener.WriteLine方法代码示例

本文整理汇总了C#中ITestListener.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# ITestListener.WriteLine方法的具体用法?C# ITestListener.WriteLine怎么用?C# ITestListener.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITestListener的用法示例。


在下文中一共展示了ITestListener.WriteLine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateReports

        private void GenerateReports(ITestListener testListener, Assembly assembly,ReportResult result)
        {
            try
            {
                string outputPath = GetAppDataPath("");
                string nameFormat = assembly.GetName().Name + ".Tests";

                string file = HtmlReport.RenderToHtml(result, outputPath, nameFormat);

                if (file != "")
                {
                    Uri uri = new Uri("file:" + Path.GetFullPath(file).Replace("\\", "/"));
                    testListener.TestResultsUrl(uri.AbsoluteUri);
                }
                else
                {
                    testListener.WriteLine("Skipping report generation", Category.Info);
                }
            }
            catch (Exception ex)
            {
                testListener.WriteLine("failed to create reports",Category.Error);
                testListener.WriteLine(ex.ToString(), Category.Error);
            }
        }
开发者ID:timonela,项目名称:mb-unit,代码行数:25,代码来源:MbUnitTestRunner.cs

示例2: Run

        protected TestRunState Run(
            ITestListener testListener, 
            Assembly assembly, 
            IFixtureFilter filter,
            RunPipeFilterBase runPipeFilter,
            TypeFilterBase typeFilter
            )
        {
            this.testListener = testListener;

            if (!CheckMbUnitVersion(assembly))
            {
                return TestRunState.Error;
            }

            assemblySetUpCount = 0;
            assemblyTearDownCount = 0;
            testFixtureSetUpCount = 0;
            testFixtureTearDownCount = 0;
            failureCount = 0;
            successCount = 0;
            ignoreCount = 0;
            skipCount = 0;

            string assemblyPath = new Uri(assembly.CodeBase).LocalPath;
            testListener.WriteLine("Starting the MbUnit Test Execution", Category.Info);
			testListener.WriteLine("Exploring " + assembly.FullName, Category.Info);
            testListener.WriteLine(String.Format("MbUnit {0} Addin", typeof(RunPipe).Assembly.GetName().Version),Category.Info);
            
            try
            {
                using (AssemblyTestDomain domain = new AssemblyTestDomain(assembly))
                {
                    //define an assembly resolver routine in case the CLR cannot find our assemblies. 
                    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolveHandler);

                    domain.TypeFilter = typeFilter;
                    domain.Filter = filter;
                    domain.RunPipeFilter = runPipeFilter;
                    domain.Load();
                    // check found tests
                    testCount = domain.TestEngine.GetTestCount().RunCount;
                    if (testCount == 0)
                    {
                        testListener.WriteLine("No tests found", Category.Info);
                        return TestRunState.NoTests;
                    }

                    testListener.WriteLine(String.Format("Found {0} tests", testCount), Category.Info);
                    // add listeners
                    domain.TestEngine.FixtureRunner.AssemblySetUp += new ReportSetUpAndTearDownEventHandler(TestEngine_AssemblySetUp);
                    domain.TestEngine.FixtureRunner.AssemblyTearDown += new ReportSetUpAndTearDownEventHandler(TestEngine_AssemblyTearDown);
                    domain.TestEngine.FixtureRunner.TestFixtureSetUp += new ReportSetUpAndTearDownEventHandler(TestEngine_TestFixtureSetUp);
                    domain.TestEngine.FixtureRunner.TestFixtureTearDown += new ReportSetUpAndTearDownEventHandler(TestEngine_TestFixtureTearDown);
                    domain.TestEngine.FixtureRunner.RunResult += new ReportRunEventHandler(TestEngine_RunResult);

                    try
                    {
                        domain.TestEngine.RunPipes();
                    }
                    finally
                    {
                        if (domain.TestEngine != null)
                        {
                            domain.TestEngine.FixtureRunner.AssemblySetUp -= new ReportSetUpAndTearDownEventHandler(TestEngine_AssemblySetUp);
                            domain.TestEngine.FixtureRunner.AssemblyTearDown -= new ReportSetUpAndTearDownEventHandler(TestEngine_AssemblyTearDown);
                            domain.TestEngine.FixtureRunner.TestFixtureSetUp -= new ReportSetUpAndTearDownEventHandler(TestEngine_TestFixtureSetUp);
                            domain.TestEngine.FixtureRunner.TestFixtureTearDown -= new ReportSetUpAndTearDownEventHandler(TestEngine_TestFixtureTearDown);
                            domain.TestEngine.FixtureRunner.RunResult -= new ReportRunEventHandler(TestEngine_RunResult);
                        }
                    }

                    testListener.WriteLine("[reports] generating HTML report", Category.Info);
                    this.GenerateReports(testListener, assembly, domain.TestEngine.Report.Result);

                    return toTestRunState(domain.TestEngine.Report.Result);
                }
            }
            catch (Exception ex)
            {
                testListener.WriteLine("[critical-failure]", Category.Error);
                testListener.WriteLine(ex.ToString(), Category.Error);
                throw new Exception("Test execution failed", ex);
            }
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:85,代码来源:MbUnitTestRunner.cs

示例3: DiagnosticMessageSink

 public DiagnosticMessageSink(ITestListener listener, string assemblyDisplayName, bool showDiagnostics)
 {
     if (showDiagnostics)
         Diagnostics.DiagnosticMessageEvent += args => listener.WriteLine($"{assemblyDisplayName}: {args.Message.Message}", Category.Warning);
 }
开发者ID:commonsensesoftware,项目名称:xunit,代码行数:5,代码来源:DiagnosticMessageSink.cs

示例4: RunAssembly

        public TestRunState RunAssembly(ITestListener testListener, Assembly assembly)
        {
            testListener.WriteLine("td.net run assembly",new Category());

            return TestRunState.NoTests;
        }
开发者ID:BennieCopeland,项目名称:NSpec,代码行数:6,代码来源:TDNetNSpecRunner.cs

示例5: RunMember

        public TestRunState RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
        {
            testListener.WriteLine("td.net run member",new Category());

            return TestRunState.NoTests;
        }
开发者ID:BennieCopeland,项目名称:NSpec,代码行数:6,代码来源:TDNetNSpecRunner.cs

示例6: RunNamespace

        public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns)
        {
            testListener.WriteLine("td.net run namespace",new Category());

            return TestRunState.NoTests;
        }
开发者ID:BennieCopeland,项目名称:NSpec,代码行数:6,代码来源:TDNetNSpecRunner.cs


注:本文中的ITestListener.WriteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。