Let us take a look to see how this can be achieved using postman data files. Environment fileįirst, create an enviornment Manage Environment option at top right. GET request used here is Įndpoint is defined in environment file and countrycode will be in data file Next step is to create a collection with a GET request and write tests to verify the response. Now write some tests to check the results. The data coming from data file will be available under “data” dictionary ( similar to global/environment variable. It can be accessed as data.VARIABLENAME or data in both test and pre requisite scripts. Below screenshot shows the test which is for validating country name based on the data file. Postman supports both CSV and JSON format. For CSV files, the first row should be the variable names as the header. JSON file should be an array of the keyvalue pair where the variable name is the key.ĭata file used in this example is below. It has 3 column, where the first column is test case ID and the second one is country code which is used in the request and the third one is the country name, which is used for asserting the response received. In this example, I am looking for 3 different country codes.
0 Comments
Leave a Reply. |