Java Test Automation / Quiz

given(), when(), then(): RestAssured First Contact

The BDD-flavored API testing DSL: request specs, path params, hamcrest body checks, and pulling values out for the next call.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
8 min

// MISSION BRIEF

Your Mission

RestAssured turned Java API testing into a readable sentence: given() a request, when() it fires, then() the response must satisfy matchers.

This quiz covers the sentence structure: what belongs in each clause, how base URI composition works, path vs query params, and how to extract data for chained calls.

// FIRST CONTACT

Battle teaser

The roles of the three clauses:

  1. Agiven() = request setup (headers, params, auth, body); when() = the HTTP verb + path; then() = assertions on the response
  2. Bgiven() = assertions; when() = setup; then() = the call
  3. CAll three are interchangeable aliases
  4. Dgiven() runs the request twice for stability
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javarestassuredapi