Bird
0
0

Which TestNG annotation attribute is used to assign a test method to one or more groups?

easy📝 Conceptual Q2 of 15
Selenium Java - TestNG Integration
Which TestNG annotation attribute is used to assign a test method to one or more groups?
A@Test(timeout = 1000)
B@Test(priority = 1)
C@Test(enabled = false)
D@Test(groups = {"groupName"})
Step-by-Step Solution
Solution:
  1. Step 1: Recall TestNG @Test attributes

    The 'groups' attribute is used to assign tests to groups.
  2. Step 2: Match attribute to usage

    @Test(groups = {"groupName"}) correctly assigns groups.
  3. Final Answer:

    @Test(groups = {"groupName"}) -> Option D
  4. Quick Check:

    Assign groups = @Test(groups) [OK]
Quick Trick: Use groups attribute inside @Test to assign groups [OK]
Common Mistakes:
  • Using priority instead of groups
  • Confusing enabled or timeout with groups
  • Missing curly braces for multiple groups

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes