Java Test Automation / Quiz
Auth Headers & Schema Guards
Preemptive vs challenged basic auth, oauth2 bearers, matchesJsonSchemaInClasspath, and GPath filters. RestAssured's security and contract layer.
- Difficulty
- Hard
- Format
- Quiz
- Points
- 200
- Estimate
- 10 min
// MISSION BRIEF
Your Mission
Two things separate a demo API test from a production one: authenticating like the client actually does, and guarding the response CONTRACT, not just a couple of fields.
This quiz covers RestAssured's auth dialects (preemptive vs challenged, oauth2), the JSON Schema validation module, GPath's power features, and failure-only logging.
// FIRST CONTACT
Battle teaser
auth().preemptive().basic(user, pass) vs auth().basic(user, pass):
- APreemptive encrypts credentials, basic sends plaintext
- BPreemptive sends the Authorization header on the FIRST request; challenged basic waits for a 401 challenge before re-sending, so APIs that reply 401/403 without a challenge make the challenged form fail mysteriously
- CThey are identical in every exchange
- DChallenged basic is faster, one fewer header
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javarestassuredauthschema-validation