Bird
0
0

You have three tests: init(), login(), and purchase(). login() depends on init(), and purchase() depends on login(). If init() fails, what happens when you run all tests together?

hard📝 Application Q15 of 15
Selenium Java - TestNG Integration
You have three tests: init(), login(), and purchase(). login() depends on init(), and purchase() depends on login(). If init() fails, what happens when you run all tests together?
Ainit fails, login and purchase are skipped
Binit fails, login runs but purchase is skipped
Cinit fails, login and purchase run anyway
Dinit fails, only purchase runs
Step-by-Step Solution
Solution:
  1. Step 1: Understand the dependency chain

    login depends on init, and purchase depends on login, forming a chain: init -> login -> purchase.
  2. Step 2: Analyze failure impact

    If init fails, login will be skipped because it depends on init. Since login is skipped, purchase will also be skipped because it depends on login.
  3. Final Answer:

    init fails, login and purchase are skipped -> Option A
  4. Quick Check:

    Failure cascades down dependent tests [OK]
Quick Trick: Failure in first test skips all dependent tests down the chain [OK]
Common Mistakes:
  • Assuming dependent tests run despite failure
  • Thinking only immediate dependent test skips
  • Believing tests run independently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes