QA Stacks

What all validations are done while performing API Testing...?

What all validations are done while performing API Testing?

1. Status code:
validates that API’s returning correct status code or not. Like 201 status code should be returned when any resource is created, 400 for bad request, 500 for internal server error, 401 for unauthorized access so on.

2. JSON Schema:
if we are working with rest assured so as per business logic sometimes we need to validate that JSON schema is correct or not.

3. Error messages:
In case of negative scenario we should get appropriate error message with error code like 400 in case of bad request.

4. Response:
In case of happy path (positive scenarios) we validate the response that response values are expected values or not.

5. Header:
we can also validate headers but it depends on the requirement.

6. Response time:
we can validate response time of the API. Response time is that time which is taken by server to validate API request and then provide response in return.