Get and Get by ID
What are we going to test and how?
Scope
Test cases for the User Management API.
API version: 1.0.0
Endpoints covered
| Method | Endpoint | Description |
|---|---|---|
| GET | /users | List users |
| GET | /users/{id} | Get a user by ID |
Test data details
users:
valid:
id: "123"
name: "Username"
email: "username@example.com"
invalid:
email: "username@"
empty_name: ""
non_existing:
id: "999999"
GET /users — List users
TC-USER-011 — Retrieve the list of users
Objective
Verify that the API returns the list of users.
Preconditions
- The API is available.
- At least one user exists.
Request
GET /users
Expected result
-
HTTP status code is
200. -
Response body contains a JSON array.
-
Each user contains:
idnameemail
-
emailhas a valid email format.
Technique
Positive testing
TC-USER-012 — Retrieve an empty user list
Objective
Verify the API behavior when no users exist.
Preconditions
- The API is available.
- No users exist.
Request
GET /users
Expected result
- HTTP status code is
200. - Response body is an empty JSON array.
Technique
Equivalence Partitioning
GET /users/{id} — Get a user
TC-USER-013 — Retrieve an existing user
Objective
Verify that an existing user can be retrieved by ID.
Preconditions
- User
123exists.
Request
GET /users/123
Expected result
-
HTTP status code is
200. -
Response body contains the requested user.
-
Returned
idis123. -
Response contains:
idnameemail
Technique
Positive testing
TC-USER-014 — Retrieve a non-existing user
Objective
Verify that the API returns 404 when the requested user does not exist.
Request
GET /users/999999
Expected result
- HTTP status code is
404. - Response indicates that the user was not found.
Technique
Equivalence Partitioning
TC-USER-015 — Retrieve a user with an empty ID
Objective
Verify the API behavior when the path parameter is empty or invalid.
Request
GET /users/
Expected result
- The API does not return a successful user response.
- API returns an appropriate client-error or routing status code.
Technique
Error guessing