🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: TestNG: all 10 questions

Quiz: TestNG · Question 5 of 10

Why use @AfterMethod(alwaysRun = true) for driver.quit()?

Why use @AfterMethod(alwaysRun = true) for driver.quit()?

  1. A.So the browser closes even if setup or the test failed
  2. B.To make tests run in parallel
  3. C.To retry failed tests
  4. D.It runs the test twice
Answer & explanation

Correct answer: So the browser closes even if setup or the test failed

Otherwise failed runs leave browsers open.

Can you get the rest right without peeking?

Take the timed Quiz: TestNG quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →