Java Test Automation / Scenario

Boss Fight: The Parallel Meltdown

A TestNG suite goes parallel to hit a 20-minute budget and 150 tests start failing at random. One static field, eight threads, zero mercy.

Difficulty
Boss
Format
Scenario
Points
300
Estimate
18 min

// MISSION BRIEF

Your Mission

The nightly regression takes 41 minutes serially. Management wants it under 20, so someone flipped parallel="methods" with thread-count="8" and went home.

Now the suite fails 30-40% of its tests, differently every night, and the retry analyzer is doing crime-scene cleanup. You have the suite file, the base class, and the failure ledger.

Diagnose the root cause, choose the real fix, and decide what to do with the retries. This is the postmortem that separates framework owners from framework users.

// FIRST CONTACT

Battle teaser

First artifact

testng.xml

Root cause of the parallel failures?

  1. AHeadless Chrome does not support parallel sessions
  2. BTestNG's parallel scheduler is unreliable above 4 threads
  3. CChromeDriver cannot run 8 instances on one machine
  4. DThe static WebDriver field is shared by all 8 threads: every @BeforeMethod overwrites the one reference, tests drive each other's browsers, and one thread's quit() kills a session another thread is mid-test on
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javatestngparallelflakinessboss