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:
- Agiven() = request setup (headers, params, auth, body); when() = the HTTP verb + path; then() = assertions on the response
- Bgiven() = assertions; when() = setup; then() = the call
- CAll three are interchangeable aliases
- Dgiven() runs the request twice for stability
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javarestassuredapi