Bird
0
0

Examine this TestNG test method declaration:

medium📝 Debug Q6 of 15
Selenium Java - TestNG Integration
Examine this TestNG test method declaration:
@Test(groups = {"smoke"})
public void testMethod() {}

What is the issue with this declaration?
AThe method must be static to use groups
BGroups attribute should be a single string, not an array
CThere is no issue; the syntax is correct
DThe groups attribute is deprecated in TestNG
Step-by-Step Solution
Solution:
  1. Step 1: Review TestNG groups syntax

    The groups attribute accepts either a single string or an array of strings.
  2. Step 2: Analyze given code

    Here, groups is assigned an array with one element "smoke", which is valid.
  3. Final Answer:

    There is no issue; the syntax is correct -> Option C
  4. Quick Check:

    Groups can be single or array [OK]
Quick Trick: Groups attribute accepts single or multiple strings [OK]
Common Mistakes:
  • Thinking groups must be a single string only
  • Believing test methods must be static for groups
  • Assuming groups attribute is deprecated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes