Using test script we can do validation and various assertion on the response, based on which the test will pass or fail. We can add a number of test script under the Tests tab which will run after the execution of the request. Consider the below example REQUESTĪbove URI gives the data of the user, whose ID is passed in the request, instead of hard coding the USER ID in the request we can write a pre-request script which will excuted before the request and on the runtime USER ID will be assigned to the request. The execution order will be in the sequenceĪlso, we can verify the order of execution in the console-logs:ĭescribe postman scripting using JavaScript and chai BDD.īy default postman internally support JavaScript and chai BDD as a framework.Īdding a pre-request script is simple, anything you want to execute before sending a request you can add as pre-request script in the Pre-request Script tab. After a response is received, as a test script under the Tests tab.Īs per the requirement, we can add pre-request and test scripts at the collection level, folder level and also at a request level.Before a request is sent to the server, as a pre-request script under the Pre-request Script tab.Where we can implement script inside the workflow of the API testing? Postman supports JavaScript using which we can write the script. Using scripting we can write test suites, create requests with a dynamic parameter and can pass data among requests. Scripting provides us with the capability to make our collection and request dynamic. Include concepts of the postman tool, REST APIs, and Web Services. List of most frequently asked questions around Postman API Testing Tool.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |