Rest Assured: reusable specs, reading the reply and checking its shape
Reuse request settings, check a reply, then pass its id to the next call. Learn which schema rules catch a bad reply and which facts still need a test.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a restaurant order form. The form already has the table number. Each guest adds a dish. The server checks the meal against the order before taking it to the table.
A is saved request set-up. A response specification is a saved set of reply checks. Tom uses them to test Daily List, a made-up to-do app. The base address lives in one place. Each test still says which task it wants.
A schema sets rules for data. It can require a task id and a true-or-false done flag. It can also limit values. A valid shape alone does not prove that Tom received his own task.
The form is a teaching picture, not a system design. Code runs the checks; the server does not read Tom's test specification.
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB An order form saves shared details while each order keeps its own checks.
- Prepare
- Call
- Check
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The printed table number | The shared base address in a request specification |
| The dish written on this order | The request data for this test |
| Checking the plate against the order | The shared reply checks plus this case’s value checks |
| The order number kept for later | The created id extracted for the next call |
WHERE THIS PICTURE STOPS
- A form is paper; a specification is code applied to a call.
- A schema can require fields and restrict values, but only through the rules it declares.
- A valid reply shape does not prove that the task belongs to the right user.
HOOK
Print once, tick often.
TELL A FRIEND
An order form: printed once, ticked each time.
OFTEN MIXED UP WITH REST Assured: your first API tests in Java. That topic writes a first test. This one shares set-up and separates schema rules from case-specific checks.
Sources & standards — 4 sources
- Implementation-specific
Usage guide (the Rest Assured project wiki) ↗ — Rest Assured project · Usage, opened 8 November 2026: Specification Re-use, Default Values, Extracting values after validation, JSON paths and Blacklist Headers from Logging. REST Assured 6.3.0 baseline; synthetic examples are editorial.
Primary sections opened in full on 8 November 2026: specification reuse, defaults, extraction after validation, JSON paths, JSON Schema settings/version selection and header logging. Current examples use 6.3.0. Older Draft 4 examples remain on the same page; the newer-version section must also be read. No publisher image is copied by this correction.
- Market practice
JSON Schema Validation — Draft2020-12 ↗ — JSON Schema authors · JSON Schema Validation Draft 2020-12, sections 6.1 (type, enum, const), 6.5.3 (required), and 7.2 (format). Opened 8 November 2026. This is the published JSON Schema dialect document, not an RFC.
Complete named units banked under V72 Phase1 gate01d542c62 before implementation; no all-client, whole-document or current tool compatibility certification.
- Implementation-specific
REST Assured 6.1.0 release notes: JSON Schema dialect support ↗ — REST Assured project · Official 6.1.0 release notes, JSON Schema support highlight; Usage Choosing the JSON Schema version. Opened 8 November 2026. New drafts selected by $schema; older versions may ignore newer keywords.
Opened the primary release highlight and linked Usage section. Synthetic test fixtures are editorial. Runtime evidence is recorded separately; release notes are not a test execution claim.
- Implementation-specific
REST Assured GettingStarted (6.3.0 dependency example) ↗ — REST Assured project · GettingStarted, Maven/Gradle and JSON Schema Validation, opened 8 November 2026. Both rest-assured and json-schema-validator use version 6.3.0 in test scope; JsonPath uses Groovy GPath.
Official product documentation, not a general standard. Relevant sections and exact release/access limitations are recorded in the V27 full-depth audit. Screens and rolling documentation can change; synthetic Daily List examples are editorial fixtures, not publisher product guarantees.
PRACTISE AND KEEP
Sources for this topic — 4 sources
- Implementation-specific
Usage guide (the Rest Assured project wiki) ↗ — Rest Assured project · Usage, opened 8 November 2026: Specification Re-use, Default Values, Extracting values after validation, JSON paths and Blacklist Headers from Logging. REST Assured 6.3.0 baseline; synthetic examples are editorial.
Primary sections opened in full on 8 November 2026: specification reuse, defaults, extraction after validation, JSON paths, JSON Schema settings/version selection and header logging. Current examples use 6.3.0. Older Draft 4 examples remain on the same page; the newer-version section must also be read. No publisher image is copied by this correction.
- Market practice
JSON Schema Validation — Draft2020-12 ↗ — JSON Schema authors · JSON Schema Validation Draft 2020-12, sections 6.1 (type, enum, const), 6.5.3 (required), and 7.2 (format). Opened 8 November 2026. This is the published JSON Schema dialect document, not an RFC.
Complete named units banked under V72 Phase1 gate01d542c62 before implementation; no all-client, whole-document or current tool compatibility certification.
- Implementation-specific
REST Assured 6.1.0 release notes: JSON Schema dialect support ↗ — REST Assured project · Official 6.1.0 release notes, JSON Schema support highlight; Usage Choosing the JSON Schema version. Opened 8 November 2026. New drafts selected by $schema; older versions may ignore newer keywords.
Opened the primary release highlight and linked Usage section. Synthetic test fixtures are editorial. Runtime evidence is recorded separately; release notes are not a test execution claim.
- Implementation-specific
REST Assured GettingStarted (6.3.0 dependency example) ↗ — REST Assured project · GettingStarted, Maven/Gradle and JSON Schema Validation, opened 8 November 2026. Both rest-assured and json-schema-validator use version 6.3.0 in test scope; JsonPath uses Groovy GPath.
Official product documentation, not a general standard. Relevant sections and exact release/access limitations are recorded in the V27 full-depth audit. Screens and rolling documentation can change; synthetic Daily List examples are editorial fixtures, not publisher product guarantees.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.