Java Test Automation / Scenario
The PayloadManager Intervention
Three tests, three copy-pasted JSON strings, one hardcoded token, and assertions that would pass on an error page. Stage the refactor.
- Difficulty
- Hard
- Format
- Scenario
- Points
- 200
- Estimate
- 14 min
// MISSION BRIEF
Your Mission
The booking-API suite grew the way suites grow: someone wrote one test with a hand-concatenated JSON string, and everyone copied it. Now a field rename breaks 40 tests, reviewers cannot diff payloads, and the assertions are string-contains theater.
You have the offending test, the team's pain list, and a proposed PayloadManager sketch. Decide what is actually wrong, what the pattern centralizes, and which assertions replace the theater.
// FIRST CONTACT
Battle teaser
First artifact
CreateBookingTest.java (current state)
The core problem with the string-built payloads:
- AString concatenation is too slow for API tests
- BThe payload is too long; shorter JSON would be fine
- CAPIs cannot parse JSON built from Java strings
- DPayload structure is invisible to the compiler and duplicated across tests: renames, typos, and escaping errors surface only at runtime, and every API change costs one manual edit per copy
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javarestassuredpayload-managerrefactoring