When we want to test an API, we need to test it on several environments for better results. For example, we will test it on our local machine and development environment, and then also on the QA environment. To optimize test implementation times and to avoid having a duplicate request in Postman, we will inject variables into this same request in order to make it testable in all environments.
So, in the following steps, we will improve our requests by creating an environment and two variables; then, we will modify our requests in order to use these variables:
- In Postman, we will start by creating an environment that we call Local, as shown in the following screenshot:
- Then, in this Local environment, we will insert a variable named PostID, which will contain the value to pass in the URL of the request. This following screenshot...