Java Test Automation / Quiz

dependsOnMethods: Chains, Skips, and alwaysRun

Why a failed login skips checkout instead of failing it, and where dependency chains stop being a design and start being a smell.

Difficulty
Medium
Format
Quiz
Points
150
Estimate
9 min

// MISSION BRIEF

Your Mission

TestNG lets tests declare prerequisites: dependsOnMethods, dependsOnGroups, alwaysRun, and the runtime SkipException. Used well, one root cause produces one failure and a clean set of skips. Used badly, it welds your suite into a fragile chain.

This quiz covers the semantics precisely, because "skipped" vs "failed" is the difference between a readable nightly report and a wall of noise.

// FIRST CONTACT

Battle teaser

checkoutTest has dependsOnMethods = {"loginTest"}. loginTest fails. checkoutTest is:

  1. AFailed, with the same error as loginTest
  2. BRemoved from the report entirely
  3. CRun anyway, dependencies only affect ordering
  4. DSKIPPED, reported separately from failures
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javatestngdependencies