本文整理汇总了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);
}
}
示例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);
}
}
示例3: DiagnosticMessageSink
public DiagnosticMessageSink(ITestListener listener, string assemblyDisplayName, bool showDiagnostics)
{
if (showDiagnostics)
Diagnostics.DiagnosticMessageEvent += args => listener.WriteLine($"{assemblyDisplayName}: {args.Message.Message}", Category.Warning);
}
示例4: RunAssembly
public TestRunState RunAssembly(ITestListener testListener, Assembly assembly)
{
testListener.WriteLine("td.net run assembly",new Category());
return TestRunState.NoTests;
}
示例5: RunMember
public TestRunState RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
{
testListener.WriteLine("td.net run member",new Category());
return TestRunState.NoTests;
}
示例6: RunNamespace
public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns)
{
testListener.WriteLine("td.net run namespace",new Category());
return TestRunState.NoTests;
}