How to Send multiple request concurrently/Sequentially in postman with different set of values for each request?

Mega picture Mega · Nov 23, 2017 · Viewed 9.9k times · Source

For example, below is the JSON request data to "add a device" in the DB. For example, I want to add 10000 devices with different IMEI number and different phone number to the server for testing purpose. So, how to send the request at once. I'm ready to create 10000 devices data with different values manually. Now I can able to send one by one only.But how to send all the request at once?

{ "device_name":"34793812453274392", "imei_num":"36xxxxxxxxxxxx5", "phone_num":"8666606451", "device_city":"Chennai", "device_state":"Tamil Nadu", }

As I'm new to POSTMAN, required detailed info. Thanks in advance.

Answer

A.Joly picture A.Joly · Nov 26, 2017

The thing that should work is :

  • you prepare your input JSon body with variables. ie, from your example :

{ "device_name":{{device_name}}, "imei_num":{{imei_num}}, "phone_num":{{phone_num}}, "device_city":{{device_city}}, "device_state":{{device_state}}, } the {{}} is for variables

  • You create a CSV file with the corresponding headers (one for each variable of your input JSON) and all the values you need:

example:

line 1 : device_name, imei_num, phone_num, device_city, device_state
line 2 : "34793812453274392", "36xxxxxxxxxxxx5", "8666606451", "Chennai", "Tamil Nadu"
... and so on ...
line 10000 :  ... 

Then, in the Postman runner (see here ), you select the data file (Data / Select file) with CSV type (you should have an option to check the content, but be careful as you'll have a lots of rows, it may take a long time, I suggest you try first with a small CSV file)

You just set ONE iteration (otherwise you'll play x times 10000 requests). It will parse your file and, for each data line, it will send your request with replacing the body's variables by the corresponding data associated to the corresponding header. Header names must have the same label as your variables.

Launching the runner will launch your 10000 requests sequentially

If you prefer, you can use JSON input file as data file, see here

Don't hesitate to have a look at postman documentation, it's pretty complete.