API test automation
REST API tests in plain English, backed by REST Assured
Test any JSON API with ready-made Cucumber steps. Send requests, save values, check fields and schemas, and see every request and response in the Serenity report.
An API test without Java
Scenario: Create and fetch a user When I send a POST request to "/users" with the body from "payloads/new-user.json" And I save the response field "id" as "userId" When I send a GET request to "/users/${userId}" Then the response status code should be 200 And the response field "name" should be "Ada" And the response should match the JSON schema "user.json"
Each step is backed by REST Assured, and the report records the full request and response for every call, so a failure shows exactly what the API returned.
Ready-made API steps
| Step | What it does |
|---|---|
Given I set the header "X-Api-Key" to "abc" | Adds a header to every following request |
Given I set the query parameter "page" to "2" | Adds a query parameter to the next request |
Given I use the bearer token "..." | Sets Authorization: Bearer ... |
When I send a GET request to "/users/42" | GET, POST, PUT, PATCH, DELETE and more |
When I send a POST request to "/users" with body: | Inline JSON as a doc string, or a body from a file |
When I save the response field "id" as "userId" | Reuse it later as ${userId} |
Then the response field "address.city" should be "Leeds" | GPath expressions, several fields at once with a table |
Then the response field "items" should have 3 items | Array sizes, comparisons, contains and not empty |
Then the response should match the JSON schema "user.json" | Validates the whole response shape |
Then the response time should be under 500 milliseconds | A simple performance guard |
Built for real APIs
- OpenAPI and Swagger input. A built-in tool summarises your spec and turns its response definitions into JSON schemas.
- No secrets in tests. Tokens and passwords come from environment variables or CI secrets via
${config:...}. - Domain steps when you need them. Log-in flows and test-data setup become business-level steps, such as
Given a booking exists for "Sally" "Brown", sharing state with the generic steps. - API and UI together. Values saved by API steps can be used in UI steps, so you can create data through the API and check it in the browser in one scenario.
- Corporate proxies supported through environment settings.
- Parallel and isolated. Each scenario has its own API session, so saved values never leak between tests.
For a step-by-step walkthrough, read our Cucumber and REST Assured example.
Automate your API test cases
Paste a manual API test case into the live demo and see the scenario it becomes.