Bird
0
0

What is wrong with this TestNG test method if the intention is to assign it to groups "ui" and "integration"?

medium📝 Debug Q14 of 15
Selenium Java - TestNG Integration
What is wrong with this TestNG test method if the intention is to assign it to groups "ui" and "integration"?
@Test(groups = "ui, integration")
public void testUIIntegration() {}
AGroups should be passed as an array, not a single string
BThe method name is invalid
CThe annotation @Test is missing parentheses
DGroups attribute is not supported in @Test
Step-by-Step Solution
Solution:
  1. Step 1: Check groups attribute format

    Groups must be passed as an array of strings using curly braces, not a single comma-separated string.
  2. Step 2: Identify the error in the code

    The code uses a single string "ui, integration" instead of {"ui", "integration"}.
  3. Final Answer:

    Groups should be passed as an array, not a single string -> Option A
  4. Quick Check:

    Groups need array syntax [OK]
Quick Trick: Use curly braces for multiple groups [OK]
Common Mistakes:
MISTAKES
  • Passing groups as one string with commas
  • Forgetting curly braces for arrays
  • Misunderstanding annotation syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes