Validate the user API contract
Medium75 pts~22 min
- Contract testing
- JSON Schema
- Negative testing
Practice app · Acme REST API
A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.
Your starter code already declares BASE_URL — call the API relative to it.
Objective
Validate the user endpoint's contract: status, headers, schema, critical fields and the error envelope.
Your task
- 1GET BASE_URL + "/users/1": assert 200 and Content-Type contains application/json.
- 2Validate the body against a schema: id (integer), name, email, role (admin|editor|viewer), active (boolean), createdAt, address, tags.
- 3Assert the critical fields: id 1, name "Ada Lovelace", email "ada@acme.test".
- 4GET BASE_URL + "/users/9999": assert 404 and error.code "USER_NOT_FOUND".
Acceptance criteria
- GET /users/1 returns 200
- A 404 from /users/{id}
- Schema validation is used
- At least 5 assertions pass
Fixtures
- apiKey
- tqa_live_key_123
- basicUser
- admin
- basicPassword
- secret
- username
- qa@target.dev
- password
- Test@123
API testing · API Testing · Featured challenges