This document describes the test cases for the SWAPI API tests. The goal is to ensure that the API endpoints for People and Planets resources are functioning correctly.
- Description: Verify that a person can be retrieved by a valid ID.
- Preconditions: A person with the given ID exists in the database.
- Steps:
- Send a GET request to
/people/1
. - Verify the response status code is 200.
- Validate the response body contains the expected fields and values.
- Send a GET request to
- Expected Result: The response status code is 200, and the response body contains the correct person data.
- Description: Verify that an error is returned when retrieving a person by an invalid ID.
- Preconditions: No person exists with the given invalid ID.
- Steps:
- Send a GET request to
/people/9999
. - Verify the response status code is 404.
- Validate the response body contains an error message.
- Send a GET request to
- Expected Result: The response status code is 404, and the response body contains an error message.
- Description: Verify that a planet can be retrieved by a valid ID.
- Preconditions: A planet with the given ID exists in the database.
- Steps:
- Send a GET request to
/planets/1
. - Verify the response status code is 200.
- Validate the response body contains the expected fields and values.
- Send a GET request to
- Expected Result: The response status code is 200, and the response body contains the correct planet data.
- Description: Verify that an error is returned when retrieving a planet by an invalid ID.
- Preconditions: No planet exists with the given invalid ID.
- Steps:
- Send a GET request to
/planets/9999
. - Verify the response status code is 404.
- Validate the response body contains an error message.
- Send a GET request to
- Expected Result: The response status code is 404, and the response body contains an error message.