liveBook · Manning

REST Assured

As explained in BDD in Action, Second Edition

REST Assured is a Java library for testing and validating REST-based HTTP APIs through programmatic requests and response assertions.

REST Assured is a Java library for automating acceptance tests against REST APIs. It sends programmatic HTTP requests, extracts response data, and supports readable assertions without browser overhead. section 13.0 section 13.7

Use REST Assured to:

Registering and checking an account

A MembershipAPI client can submit a JSON registration, extract frequentFlyerNumber, then request the account status and assert its tier, activation state, and points. A focused response model avoids coupling the test to unrelated JSON fields. section 13.4.2 section 13.4.5

Response response = RestAssured.given()                        #1
        .contentType(ContentType.JSON)                         #2
        .body(newMember)                                       #3
        .post("http://localhost:3000/api/frequent-flyer");     #4

Shows the fluent request construction for a JSON POST: set content type, provide the member body, and call the endpoint. section 13.4.2

public AccountStatus getMemberStatus(String frequentFlyerNumber) {
    return RestAssured.given()
                    .get("/frequent-flyer/{number}", frequentFlyerNumber)   #1
                    .jsonPath()                
                    .getObject(".", AccountStatus.class);                   #2
}

Shows a GET request using a path parameter and conversion of the JSON response into a focused AccountStatus record. section 13.4.5

How BDD in Action, Second Edition covers it

How deep it goes
Explains request construction, URI configuration, JSONPath extraction, response mapping, and focused assertions, but not library internals.
Examples
Demonstrates frequent flyer registration, account retrieval, JSON response samples, Java records, and tier-and-points assertions.
What it assumes
Assumes Java, REST APIs, JSON, and acceptance-testing context; teaches the request, extraction, mapping, and assertion workflow.
What you can do after
Apply it via Java to build automated acceptance tests that call REST endpoints, inspect JSON responses, and validate business outcomes.
How it connects
Connects REST API testing with Java, JSONPath, BDD, microservices, acceptance testing, and environment configuration.

Also explained in

Compare how 2 books explain REST Assured →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of BDD in Action, Second Edition. The section links point to the parts of the book it draws on.