我有以下试用代码:
[TestMethod]
public void VisibilitySucces()
{
testPage.HideParagraph();
testPage.ShowParagraph();
}
[TestMethod, ExpectedException(typeof(WebDriverTimeoutException))]
public void ShouldBeVisibleException()
{
testPage.ShouldBeVisibleException();
}
[TestCleanup]
public void TestCleanup()
{
switch (TestContext.CurrentTestOutcome)
{
case UnitTestOutcome.Passed:
Console.WriteLine("Passed!");
break;
default:
Console.WriteLine("The test outcome is " + TestContext.CurrentTestOutcome.ToString());
break;
}
Browser.Quit();
}
现在,第一个测试的结果Passed
符合预期。
第二个测试确实抛出异常(我在没有ExpectedException
属性的情况下测试了它)。它被标记为视觉传递,但控制台中的结果显示为InProgress
。
在TestCleanup
?