API Testing with Postman – Common Test Cases
Scenario Request (Example) Expected Response
POST /api/login Status: 200 OK
Valid Login Body: {"username":"testuser","password":"123456"}
Response: {"status":"success", "token":"abc123xyz"}
POST /api/login Status: 401 Unauthorized
Invalid Password Body: {"username":"testuser","password":"wrongpass"}
Response: {"status":"error", "message":"Invalid crede
POST /api/login Status: 400 Bad Request
Empty Fields Body: {"username":"","password":""} Response: {"status":"error", "message":"Fields requir
POST /api/login Status: 404 Not Found
User Not Found Body: {"username":"wronguser","password":"123456"}
Response: {"status":"error", "message":"User does n
GET /api/userinfo Status: 401 Unauthorized
Token Expired Header: Authorization: Bearer <expired_token>
Response: {"status":"error", "message":"Token expire
GET /api/userinfo Status: 403 Forbidden
Access Without Auth (No Authorization header) Response: {"status":"error", "message":"Access deni