3

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?

FDM
  • 628
  • 6
  • 18
  • I am not seeing this behavior in a simple case that just throws an exception. Can you reproduce it without the webdrivertimeoutexception? Do you have any timeouts set for your test run? – John Koerner Apr 03 '16 at 13:42

0 Answers0