Skip to content
CodeKruPro

expectedExceptions and timeOut in TestNG

QuizMediumJava only

Which statement about these two @Test attributes is true in TestNG 7?

  • @Test(expectedExceptions = ArithmeticException.class) passes when the method throws that exception; @Test(timeOut = 200) fails a test that runs longer than 200 ms
  • expectedExceptions makes the test skip when the exception happens
  • timeOut is in seconds
  • timeOut retries the test until it is fast enough

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in