Bird
0
0

Why does TestNG allow both priority and dependsOnMethods to control test execution order instead of just one?

hard📝 Conceptual Q10 of 15
Selenium Java - TestNG Integration
Why does TestNG allow both priority and dependsOnMethods to control test execution order instead of just one?
ABecause priority is deprecated and dependsOnMethods replaces it
BTo provide flexible control for both ordering and dependency management
CTo confuse testers and make tests complex
DBecause dependsOnMethods only works with groups
Step-by-Step Solution
Solution:
  1. Step 1: Understand the roles of priority and dependsOnMethods

    Priority sets execution order numerically; dependsOnMethods enforces dependencies between tests.
  2. Step 2: Recognize the need for both features

    Combining both allows testers to control order and ensure dependent tests run only after prerequisites pass.
  3. Final Answer:

    To provide flexible control for both ordering and dependency management -> Option B
  4. Quick Check:

    Flexible order and dependency control = B [OK]
Quick Trick: Priority orders; dependsOnMethods manages dependencies [OK]
Common Mistakes:
  • Thinking priority is deprecated
  • Believing dependsOnMethods only works with groups
  • Assuming one feature replaces the other

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes