Bird
0
0

Given the following TestNG code:

medium📝 Predict Output Q13 of 15
Selenium Java - TestNG Integration
Given the following TestNG code:
@Test
public void login() { Assert.assertTrue(false); }

@Test(dependsOnMethods = {"login"})
public void dashboard() { System.out.println("Dashboard loaded"); }

What will happen when these tests run?
Alogin fails, dashboard is skipped
Blogin fails, dashboard runs and prints message
CBoth login and dashboard run and pass
Dlogin passes, dashboard is skipped
Step-by-Step Solution
Solution:
  1. Step 1: Analyze login test result

    The login test asserts false, so it will fail.
  2. Step 2: Understand effect on dependent test

    The dashboard test depends on login. Since login failed, dashboard will be skipped and not run.
  3. Final Answer:

    login fails, dashboard is skipped -> Option A
  4. Quick Check:

    Dependent tests skip if dependency fails [OK]
Quick Trick: Failed dependency causes dependent test to skip [OK]
Common Mistakes:
  • Assuming dependent test runs despite failure
  • Thinking both tests pass
  • Confusing skip with fail

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes