I have the following tryout code:
[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();
}
Now, the first test has the outcome Passed
as expected.
The second test does throw the exception (I've tested it without the ExpectedException
attribute). It's marked as passed visually, but the outcome in the console is showing InProgress
.
How can this be when this status is queried in the TestCleanup
?