Bird
0
0

Find the issue in this TestNG snippet:

medium📝 Debug Q7 of 15
Selenium Java - TestNG Integration
Find the issue in this TestNG snippet:
@Test(priority=1)
public void testOne() {}
@Test(priority=2, dependsOnMethods={"testTwo"})
public void testThree() {}
@Test(priority=3)
public void testTwo() {}
ANo issue, code is correct
BDependsOnMethods references a non-existent method
CPriority values must be unique and sequential
DtestThree depends on testTwo but testThree has higher priority
Step-by-Step Solution
Solution:
  1. Step 1: Analyze priority and dependency conflict

    testThree depends on testTwo but has higher priority (2) than testTwo (3), causing execution order conflict.
  2. Step 2: Understand TestNG execution rules

    Dependencies override priority, so testTwo runs before testThree despite priority values.
  3. Final Answer:

    testThree depends on testTwo but testThree has higher priority -> Option D
  4. Quick Check:

    Dependency overrides priority conflicts = A [OK]
Quick Trick: Dependencies can override priority order in TestNG [OK]
Common Mistakes:
  • Assuming priority always controls order
  • Thinking dependsOnMethods must reference higher priority
  • Believing priority must be sequential

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes