REST Assured
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
write readable HTTP tests.
Planned topics
- REST Assured uses
given / when / thento send requests and check responses. Verify the current version before recording. - Set the port from
@LocalServerPort. - Check status, headers, and body fields with JSON paths:
body("items.size()", is(2)). extract().path(...)pulls a value for the next step (for example a token or id).- Check body fields that matter, not the whole JSON string.
Draft outline details
Demonstration
given().port(port).contentType(JSON).body(newOrder)
.when().post("/api/orders")
.then().statusCode(201)
.header("Location", containsString("/api/orders/"))
.body("status", equalTo("NEW"));Check your understanding
Why not compare the entire JSON string?
Show answer
It breaks on harmless changes such as field order or new fields.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.