About
The REST Assured Guide is a hands-on course in testing web APIs in Java with REST Assured. It starts with a first given().when().then() and ends with real OAuth 2.0 tokens from Keycloak in Docker, over 12 modules and 60 guides. Every guide comes with tests you can run, change and break.
Why This Guide Exists
I use this guide to learn REST Assured myself. Writing a technology down, step by step, with tests that have to pass, is the best way I know to understand it properly, rather than only well enough to copy an example.
That shapes how the guide is written:
- Everything is checked against real code. Each guide is built from a test class in the companion repository. The outputs, error messages and timings in the guides come from running those tests.
- Failures matter as much as passes. Every guide shows you how to make a test fail, and what the failure looks like, because reading failures is most of the work in API testing.
- The examples are realistic. The APIs under test are payment, account and open banking APIs, with the rules such APIs really have: money as exact decimals, idempotency keys, signed requests, scopes and problem details.
- It stays current. The guide uses REST Assured 6.3, JUnit 6, Jackson 3, Spring Boot 4 and JDK 26, and notes what changes in REST Assured 7.
What the Guide Covers
| Modules | Topics |
|---|---|
| 1 to 3 | The basics: requests, responses, logging, reading failures, building requests, and checking JSON, XML and HTML in depth |
| 4 to 6 | Extracting values, mapping to Java records, reusable specifications, configuration, and schema and contract validation |
| 7 and 8 | Authentication and transport security, filters, request signing, custom authentication, parsers and listeners |
| 9 to 12 | Data-driven tests, workflows, HTTP semantics, asynchronous APIs, WireMock, Spring Boot, Testcontainers, parallel runs and tagged suites |
The REST Assured Learning Guide lists every module and guide, with its level and what you’ll learn.
How to Use the Guide
Start from the REST Assured Learning Guide, and pick your starting point:
- Beginner: start at Module 1, and work through the modules in order.
- Intermediate: start at Module 4.
- Advanced: jump to the modules you need, from Module 7 onwards.
The modules build on each other, but their code is independent, so you can run any module on its own. Every guide follows the same layout:
- What You’ll Build and What You Need: the result, and what to know before you start.
- Understand the concept: the problem, the idea that solves it, and when to use it.
- Meet the API Under Test: the endpoints and rules the tests check.
- Step-by-step build: one small step at a time, each with a goal, the code, what’s happening, and a checkpoint.
- Run the Tests: the command, the expected output, a deliberate failure, and troubleshooting.
- Try It Yourself: two exercises, each with a hint and a solution.
- Summary and What’s Next: the key points, the code, and where to go from here.
You can build each test class step by step as you read, or open the finished class in the repository and read along. Either way, run the tests: changing a line and watching what fails teaches more than reading about it.
The GitHub Repository
All the code is in the REST Assured Examples repository on GitHub, one Maven module per guide module. Each module has a README with its domain, its test classes and the commands to run them.
You need:
- JDK 26 or later
- Maven 3.9 or later
- Docker, only for the Keycloak tests in Module 12; without it, those tests are skipped
To get the code and run every test:
1
2
3
git clone https://github.com/javanibble/rest-assured-examples.git
cd rest-assured-examples
mvn test
The tests start their own APIs on free ports of localhost, so nothing else needs to be running. To run one module or one class:
1
2
mvn test -pl module-07
mvn test -pl module-03 -Dtest=NumbersAndMoneyTest
The code is released under the MIT License, so you can use it in your own projects. If something in a guide doesn’t match what you see when you run the code, the code is the reference: please open an issue in the repository.