🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: TestNG: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which annotation runs before EVERY test method?
  2. Q2. A @DataProvider returns 3 rows. How many times does the linked @Test run?
  3. Q3. What happens if you forget soft.assertAll()?
  4. Q4. How do you run only the smoke group from Maven?
  5. Q5. Why use @AfterMethod(alwaysRun = true) for driver.quit()?
  6. Q6. Which annotation runs once before all the tests in a class?
  7. Q7. What is the difference between a hard and a soft assertion?
  8. Q8. How do you check that a method throws an exception in TestNG?
  9. Q9. What is a TestNG listener used for?
  10. Q10. What does <suite parallel="methods" thread-count="4" do in testng.xml?