All quizzes
Free quiz · 20 questions in the bank

TestNG quiz

Test your TestNG knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is the purpose of TestNG's `@BeforeMethod` and `@AfterMethod` annotations?

Questions in this quiz
  1. What is the purpose of TestNG's `@BeforeMethod` and `@AfterMethod` annotations?
  2. What does TestNG's built-in support for "data providers" (`@DataProvider`) enable?
  3. What does the `invocationCount` attribute (e.g. `@Test(invocationCount = 5)`) do on a TestNG test method?
  4. Why might integration tests specifically benefit from TestNG's explicit dependency (`dependsOnMethods`) and grouping features more than typical isolated unit tests would?
  5. What is a "test suite" in TestNG terminology, as distinct from an individual "test class" or "test method"?
  6. What does the `enabled` attribute (e.g. `@Test(enabled = false)`) do on a TestNG test method?
  7. What is the purpose of TestNG's `@BeforeClass` and `@AfterClass` annotations, and how do they differ from `@BeforeMethod`/`@AfterMethod`?
  8. What is a `testng.xml` file used for?
  9. What is a general tradeoff to consider when using `dependsOnMethods` to chain TestNG tests together, compared to writing fully independent test methods?
  10. What does an `@Test(expectedExceptions = SomeException.class)` annotation configuration do in TestNG?
  11. What is TestNG?
  12. What is the relationship between TestNG and Selenium, when TestNG is used for web UI test automation?
Gaps to close?
Read the curated TestNG notes — core concepts, patterns, interview prep.
TestNG notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web