本文整理汇总了C#中ITestResult.HasTestSucceeded方法的典型用法代码示例。如果您正苦于以下问题:C# ITestResult.HasTestSucceeded方法的具体用法?C# ITestResult.HasTestSucceeded怎么用?C# ITestResult.HasTestSucceeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITestResult
的用法示例。
在下文中一共展示了ITestResult.HasTestSucceeded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFinished
public void TestFinished(ITestResult result)
{
var testAssembly = result.Test as TestAssembly;
if (testAssembly != null)
{
this.WriteVerbose("=== Executed {0} tests in assembly {1} ===",
testAssembly.TestCaseCount,
testAssembly.Assembly.FullName);
this.WriteInfo("\nPassed : {0}\tFailed : {1}",
result.PassCount, result.FailCount);
}
var testFixture = result.Test as TestFixture;
if (testFixture != null)
{
if (result.FailCount > 0)
{
this.WriteError("Test Fixture {0} ({1}) has {2} failures.",
testFixture.Name, testFixture.FullName, result.FailCount);
if (result.HasChildren)
{
foreach (var childResult in result.Children)
{
if (childResult.ResultState.Site != FailureSite.Test)
TestFinished(childResult);
}
}
this.WriteError("\tMessage : {0}", result.Message);
this.WriteError("\tStack trace : {0}", result.StackTrace);
}
this.WriteVerbose(" --- Executed tests in class {0} ---\n", testFixture.FullName);
}
var testMethod = result.Test as TestMethod;
if (testMethod != null)
{
if (result.FailCount > 0)
{
this.WriteError("FAIL {0} ({1})", testMethod.MethodName, testMethod.FullName);
this.WriteError("\tMessage : {0}", result.Message);
this.WriteError("\tStack trace : {0}", result.StackTrace);
}
if (result.InconclusiveCount > 0)
{
this.WriteInfo("INCONCLUSIVE {0}", testMethod.MethodName);
}
if (result.PassCount > 0)
{
this.WriteInfo("PASS {0}", testMethod.MethodName);
}
TestCompleted(testMethod);
var testSucceeded = result.HasTestSucceeded();
TestCompleted(testMethod.Name, testSucceeded);
if (!testSucceeded)
FailedTestMethods.Add(testMethod);
}
}