CRUD Feature Testing in REST API
Learn how to test the CRUD feature in the REST API Application.
We'll cover the following...
Test the CRUD feature
Test CRUD features, including creating, retrieving, updating, and deleting an item.
Test for getting all items feature
To get started, we create the only test case that can be created for the get all items feature.
In the code above, the test case for the get all items feature is created. The expected result of this test is the response status code 200.
Test for getting item by ID feature
We create the following two test cases for the get item by ID feature. Getting the item is successful. Getting the item fails(the item is not found).
First, we create the test case for the get item by ID feature.
As seen in the code above, the test case for getting an item is created. The expected result of this test case is the response status code 200.
Next, we create the test case for failing to get an item by ID (the item is not found).
In the code above, the test case for failing to get an item by ID is created. The expected result is the response status code 404 because the item data can’t be found inside the database.