This document outlines the steps required to test some of the services available in MyStoreAPI.
The following API endpoints will be tested:
POST /order/new
POST /catalog/product
GET /order/{id}
POST /order/{id}/product
DELETE /order/{id}/product/{productId}
DELETE /order/{id}
Go to MyStoreAPI
-
Use
POST
/order/new
to create a new order:- Use random values generated by Postman/Karate (through JavaFaker) for the fields depending on the type.
- Catch the value of the
id
variable in the response to use later. - Catch the value of the
customer
variable to use later. - Validate the response code.
- Validate the response body:
- Postman:
status
anduser
. - Karate: the whole body with fuzzy matching.
- Postman:
-
Use
POST
/catalog/product
to create a new product:- Use random values generated by Postman/Karate (through JavaFaker) for the fields depending on the type.
- Catch the value of the
id
variable in the response to use later. Save it as a different variable name from the previousid
. - Catch the value of the
name
variable to use later. - Catch the value of the
price
variable to use later. - Validate the response code.
- Validate the response body:
- Postman:
status
andprice
. - Karate: the whole body with fuzzy matching.
- Postman:
-
Use
GET
/order/{id}
to verify the order previously created:- Compare the
customer
value in the response body with the one created previously. - Validate the response code.
- Compare the
-
Use
POST
/order/{id}/product
to add the product to the order:- The id in the URL is the order's id, while the one in the body is the product's id.
- Use random values generated by Postman/Karate (through JavaFaker) for the fields depending on the type.
- Save the
amount
variable to compare it in the next step.
-
Use
GET
/order/{id}
to verify the previously created order and its added product:- Compare the
customer
value in the response body with the one created previously. - Compare the
name
value of the product with the one obtained from the query. - Compare the total cost with the amount of products and the price.
- Compare the
-
Use
DELETE
/order/{id}/product/{productId}
to remove the product from the order. -
Use
GET
/order/{id}
to verify the order:- Verify that there are no products in the order.
-
Use
DELETE
/order/{id}
:- Verify the status message.
-
Use
GET
/order/{id}
to verify the order:- Verify that the server response status is 404.
- Verify the response message.
-
Use
POST
/catalog/product
to create a new product:- Use an Scenario Outline to test the fields in the body:
- "name": null
- "price": "string"
- Verify the response message.
- Use an Scenario Outline to test the fields in the body:
Following these test steps will ensure that the MyStoreAPI is functioning as intended and that the whole homework was done successfully.