Bird
0
0

If testB depends on testA and testA fails, what happens to testB in TestNG?

easy📝 Conceptual Q2 of 15
Selenium Java - TestNG Integration
If testB depends on testA and testA fails, what happens to testB in TestNG?
AtestB is skipped and not executed.
BtestB runs normally regardless of testA's result.
CtestB runs but is marked as failed.
DtestB runs before testA.
Step-by-Step Solution
Solution:
  1. Step 1: Understand dependency failure behavior

    If a test method depends on another and that method fails, TestNG skips the dependent test to avoid cascading failures.
  2. Step 2: Confirm the skip behavior

    TestNG marks the dependent test as skipped, not failed or executed.
  3. Final Answer:

    testB is skipped and not executed. -> Option A
  4. Quick Check:

    Failed dependency causes skip = B [OK]
Quick Trick: Failed dependencies cause dependent tests to skip [OK]
Common Mistakes:
  • Assuming dependent tests run even if dependency fails
  • Confusing skip with fail status
  • Thinking dependent tests run before dependencies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes