MSTest:为什么在ExpectedCondition之后TestOutcome = InProgress?

时间:2016-04-01 20:14:50

标签: mstest expected-exception testcontext

我有以下试用代码:

[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

中查询此状态时,如何处理?

0 个答案:

没有答案