API test suite (Postman and REST Assured)
Test a public REST API for status codes, response schema, data and error handling, manually and automated.
What you'll learn
- âHTTP methods and status codes
- âSchema validation
- âChaining requests and environments
What you'll build
- âPostman collection with tests
- âREST Assured automated suite
- âJSON schema validation
- âNegative tests (bad input, missing auth)
Step-by-step guide
- 1
Pick an API
A practice API such as reqres.in or restful-booker (designed for testing).
- 2
Postman
Requests for list, get, create, update, delete; pm.test assertions on status and fields; environment variables for base URL and token.
- 3
Chain requests
Save an id or token from one response into a variable and use it in the next request.
- 4
REST Assured
given().baseUri(...).body(...).when().post("/booking").then().statusCode(200).body("bookingid", notNullValue()).
- 5
Schema
Validate responses with matchesJsonSchemaInClasspath("booking-schema.json").
- 6
Negative tests
Missing fields, wrong types, no token, unknown id; check the API returns proper errors.
- 7
Run in CI
Run Postman collections with newman and REST Assured with mvn test in GitHub Actions.
đ Make it stand out
- +Contract testing
- +Performance smoke test
- +Test data cleanup