TOPIC 50/6217 MINNOT STARTED

REST Assured: your first API tests in Java

Send a web request from Java, check the reply, and prove a bad reply fails. API means application programming interface.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a postal clerk with a checklist. A clerk sends a letter to a shop. The reply needs the right status, details and items. A tick beside the status does not check the items too. REST stands for Representational State Transfer, a web-service style.

Tom tests Daily List, a made-up task app. He uses , a Java library. It sends a web request and checks the reply. The app exposes an , an application programming interface that lets code ask for data.

Tom asks for task 31. The reply says the request worked, yet the task title is wrong. A status-only test would pass. A title check catches the fault.

Picture limit: the checklist is written by a person. The library cannot know which rules the app should meet. Daily List and its data are SYNTHETIC / TRAINING ONLY.

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 Send an request, a code-to-app request, then check the expected status, headers and body.

  1. Given
  2. When
  3. Then
Postal clerk

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The clerkThe test
The letterThe request
The ticked listThe checks in then
The shopThe API under test

WHERE THIS PICTURE STOPS

  • The person writes the checklist; the library cannot infer the app's rules.
  • A tick beside the status does not prove the returned task is right.
  • A manual replay can help, but it does not prove the cause of a failure.

HOOK

Given, when, then.

TELL A FRIEND

A postal clerk: set up the letter, send it, tick the list.

OFTEN MIXED UP WITH Your first scripted API check: from a manual request to a repeatable test. That topic writes a first check in a script. This one does it in Java with a library and a runner.

Sources & standards — 4 sources
  1. Implementation-specific

    Usage (Representational State Transfer (REST) Assured library wiki) ↗ — Representational State Transfer (REST) Assured project (GitHub wiki) · Official Usage, opened 8 November 2026: static imports, JSON examples/Groovy GPath, Note on syntax, response status/body/headers, request body and default values. Synthetic lab outcomes were also checked with actual REST Assured 6.3.0.

    Per the search excerpt, a Java library for testing web APIs with a given, when, then layout: given holds the request set-up, when sends the request and then checks the reply. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

  2. Implementation-specific

    REST Assured GettingStarted (6.3.0 dependency example) ↗ — REST Assured project · Official GettingStarted, opened 8 November 2026: Maven dependencies, test scope, JsonPath inclusion and static imports. Lab pins REST Assured 6.3.0; not a promise about later releases.

    Version-scoped product behaviour; relevant primary sections opened 6 November 2026. · Checked 2026-11-06

    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.

  3. Implementation-specific

    JUnit 5.11.4 User Guide: test lifecycle and execution ↗ — JUnit team · JUnit 5.11.4 User Guide, opened 8 November 2026: annotations, test classes/methods, assertions and Maven/console execution. Version matches the teaching lab.

    Version-specific test framework guidance matching the local first-tests lab. · Checked 2026-11-08

    Opened annotations, test classes/methods, assertions and Maven/console execution sections. The lab uses Jupiter 5.11.4 and Platform Console 1.11.4; no latest-version claim or screenshot reuse.

  4. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal · Original Daily List first-tests fixture and checklist analogy. Only loopback training data; not a real product contract or publisher illustration.

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

PRACTISE AND KEEP

Sources for this topic — 5 sources
  1. Implementation-specific

    Usage (Representational State Transfer (REST) Assured library wiki) ↗ — Representational State Transfer (REST) Assured project (GitHub wiki) · Official Usage, opened 8 November 2026: static imports, JSON examples/Groovy GPath, Note on syntax, response status/body/headers, request body and default values. Synthetic lab outcomes were also checked with actual REST Assured 6.3.0.

    Per the search excerpt, a Java library for testing web APIs with a given, when, then layout: given holds the request set-up, when sends the request and then checks the reply. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

  2. Implementation-specific

    REST Assured GettingStarted (6.3.0 dependency example) ↗ — REST Assured project · Official GettingStarted, opened 8 November 2026: Maven dependencies, test scope, JsonPath inclusion and static imports. Lab pins REST Assured 6.3.0; not a promise about later releases.

    Version-scoped product behaviour; relevant primary sections opened 6 November 2026. · Checked 2026-11-06

    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.

  3. Implementation-specific

    JUnit 5.11.4 User Guide: test lifecycle and execution ↗ — JUnit team · JUnit 5.11.4 User Guide, opened 8 November 2026: annotations, test classes/methods, assertions and Maven/console execution. Version matches the teaching lab.

    Version-specific test framework guidance matching the local first-tests lab. · Checked 2026-11-08

    Opened annotations, test classes/methods, assertions and Maven/console execution sections. The lab uses Jupiter 5.11.4 and Platform Console 1.11.4; no latest-version claim or screenshot reuse.

  4. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal · Original Daily List first-tests fixture and checklist analogy. Only loopback training data; not a real product contract or publisher illustration.

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

  5. Implementation-specific

    Java 21 HttpServer API ↗ — Oracle · Java 21 HttpServer API: bound address/port, context matching, start and stop. Opened 8 November 2026. The authored exercise restricts the server to loopback and exact paths.

    Simple local HTTP fixture lifecycle; not a production server recommendation. · Checked 2026-11-08

    Opened address binding, context matching, start and stop. The original training fixture checks exact paths despite prefix context matching and binds only to 127.0.0.1. No publisher images reused.

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.