We should identify and list the reusable functions to reduce code repeatability and increase maintainability.Īdd pre-request scripts and post request script Run the tests and get the request pass/fail status. Moreover, only when something changes we need to update it in one place to reflect in all tests.įor the above scenarios, we need to add requests, and under the Test tab, we need to write tests and validate the response (status code, response time). We can use these variables in the script, making it readable and understandable. In that case, we should define the test data in global and local variables based on where they will be used. The same value we use in other HTTP requests like GET/PUT/DELETE requests to perform CRUD operations. In the above example, when we send POST requests to create a Google map location, then in the API response, we get “place_id”. It helps to maintain the requests as shown below.ĭefine local level and global level variables Suppose we want to create a Test suite like Smoke, Sanity, and System test requests, then we can create folders under the collection as per suite and Organise the API requests by placing them in their respective folder. It will reduce the testing efforts and number of requests. It will help to execute the above-created API requests in the required environment without changing test requests. If we want to execute a created request on different test environments like QA, Dev, Stage, and Prod, we need to create those required environments in Postman.
0 Comments
Leave a Reply. |