Sample Test Cases
- Verify the API response status code is 200 OK.
- Verify the response format (e.g., JSON, XML).
- Validate all required fields are present in the response.
- Ensure correct GET, POST, PUT, DELETE methods are implemented.
- Verify endpoint URLs are correct.
- Check response time is within acceptable limits (e.g., <2 seconds).
- Validate API request parameters are correctly processed.
- Check for proper HTTP response headers (e.g., Content-Type).
- Ensure the response payload size is within limits.
- Validate that malformed requests return 400 Bad Request.
Interview Questions & Answers
Q1. What is an API?
A: An API is a set of protocols and tools for building software applications that interact with other systems.
Q2. What is the difference between GET and POST methods?
A: GET retrieves data; POST submits new data to the server.
Q3. How do you validate an API response?
A: By checking status code, response body, headers, and response time.
Q4. What tools can be used for API testing?
A: Postman, REST Assured, SoapUI, Swagger, JMeter.
Q5. What are HTTP status codes?
A: Codes that represent the result of the HTTP request (e.g., 200 OK, 400 Bad Request).
👉The Next Questions-2: API TEST CASES