TC-47-003 - Database API
Test Case ID | TC-47-003 |
Author | Alena Galysheva |
Date of creation | 20.06.2023 |
Class | Functional |
Type | --- |
Update history
- version 0.1 - 20.06.2023 - Alena Galysheva - test case created
Test case description
This test case verifies the functionality of the FEA-47-answers-database.
Source for the test
This test is based on the following feature requirement:
- Feature: FEA-47-answers-database
Prerequisites and test steps
Prerequisites
- The database is properly implemented and contains valid data.
- The Skill Collector Docker container is up and running in the testing environment.
- The necessary test data is prepared and ready to be used for the testing.
Test steps
# | Action | Expected result |
---|---|---|
1 | Execute API calls with valid required parameters and endpoints. | API calls are successfully executed without any errors. |
2 | Check the status code for each API request. | GET requests return a status code of 200 (OK), POST requests return 201, and DELETE requests return 200. |
3 | Check the payload and JSON data of each response. | The response payloads contain valid data as defined in the test data. |
4 | Compare the initial state and final state of the tables accessed by the requests. | GET requests do not change the number of entries, POST requests add 1 new entry, and DELETE requests remove 1 entry. |
5 | Attempt to create a user with an existing hash and perform steps 2-4. | Creating a user with an existing hash is not allowed. The API returns a 500 error with an error message in JSON format. |
6 | Attempt to create a user with a different username but an already existing password and perform steps 2-4. | Creating a user with a different username but an already existing password is allowed as long as the passwords are different. |
7 | Attempt to create a user with a name and password that already exist in the database and perform steps 2-4. | Creating a user with a name and password that already exist in the database is not allowed. The API returns an error (code unknown) with an error message in JSON format. |
8 | Attempt to delete a user with a hash ID that does not exist in the database and perform steps 2-4. | Deleting a user with a non-existent hash ID is not possible. The API returns a 404 error with an error message in JSON format. |
9 | Attempt to add a rating with an invalid hash and perform steps 2-4. | Adding a rating with an invalid hash is not allowed. The API returns a 500 error with an error message in JSON format. |
10 | Attempt to delete data with an invalid login token and perform steps 2-4. | Deleting data with an invalid login token is not allowed. The API returns a 500 error with an error message in JSON format. |
11 | Execute API calls with missing header data and perform steps 2-4. | API calls with missing header data should not work, but the specific error it throws is unknown. |
12 | Execute API calls with invalid header data and perform steps 2-4. | API calls with invalid header data should not work. |
13 | Execute API calls with invalid endpoints and perform steps 2-4. | API calls to invalid endpoints should not work. |
14 | Attempt to perform POST requests with bad formatting in the request body and perform steps 2-4. | POST requests with bad formatting in the request body should not work. |
15 | Attempt to perform POST requests with missing data in the request body and perform steps 2-4. | POST requests with missing data in the request body should not work. |
16 | Attempt to perform POST requests with additional data in the request body and perform steps 2-4. | POST requests with additional data in the request body should not work. |
17 | Attempt to perform POST requests with invalid data types in the request body and perform steps 2-4. | POST requests with invalid data types in the request body should not work. |
18 | Attempt to perform POST requests with overflow data types, boundary values, null values, undefined values, and perform steps 2-4. | POST requests with overflow data types, boundary values, null values, and undefined values should not work. |
19 | Execute API calls to endpoints with unsupported methods and perform steps 2-4. | Executing API calls to endpoints with unsupported methods is not possible. |
End state
Answers database API functions correctly with valid inputs, returns the expected status codes and responses, maintains the integrity of the database, and handles various error scenarios appropriately.
To be taken into account during test
The following API calls are to be tested (RESERVED tag means that the API call will be used in a future Skill Collector implementation):
API Call | Action |
---|---|
GET http://localhost:3000/api/skills | List all skills |
GET http://localhost:3000/api/users | List all user hashes |
GET http://localhost:3000/api/users/:id | Get user hash by ID |
GET http://localhost:3000/api/:hash | Check if a user hash exists |
POST http://localhost:3000/api/login | Login to the database (RESERVATION) |
POST http://localhost:3000/api/register | Register a user (RESERVATION) |
POST http://localhost:3000/api/ratings | Add ratings |
POST http://localhost:3000/api/users/:hash | Add a user hash |
DELETE http://localhost:3000/api/users/:id | Delete a user hash (RESERVATION) |
PASS/FAIL Criteria
- PASS: All test steps are completed successfully, and the output matches the expected results.
- FAIL: Any of the test steps fail, or the output does not match the expected results.