如何在邮递员中同时/顺序发送多个请求,每个请求具有不同的值集? [英] How to Send multiple request concurrently/Sequentially in postman with different set of values for each request?

查看:61
本文介绍了如何在邮递员中同时/顺序发送多个请求,每个请求具有不同的值集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,下面是在数据库中添加设备"的JSON请求数据.例如,我要向服务器添加10000个具有不同IMEI号码和不同电话号码的设备,以进行测试.因此,如何立即发送请求.我准备手动创建具有不同值的10000个设备数据.现在我只能一一发送.但是如何一次发送所有请求?

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":金奈","device_state":泰米尔纳德邦",}

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

由于我是POSTMAN的新手,所以需要详细信息.预先感谢.

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

推荐答案

应该起作用的是:

  • 您可以使用变量准备输入JSon主体.即,根据您的示例:

{"device_name":{{device_name}},"imei_num":{{imei_num}},"phone_num":{{phone_num}},"device_city":{{device_city}},"device_state":{{device_state}},} {{}}用于变量

  • 您将创建一个CSV文件,其中包含相应的标题(输入JSON的每个变量一个)和所需的所有值:

示例:

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 :  ... 

然后,在Postman运行程序中(请参见此处),选择CSV类型的数据文件(数据/选择文件)(应该有一个选项可以检查内容,但是要小心,因为会有很多行,这可能需要很长时间,我建议您首先尝试使用小型CSV文件)

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)

您只需设置一个迭代(否则您将播放10000次请求的x倍).它将解析您的文件,并且对于每个数据行,它将通过将正文变量替换为与相应标头相关的相应数据来发送您的请求.标题名称必须与变量相同的标签.

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.

启动跑步者将依次启动您的10000个请求

Launching the runner will launch your 10000 requests sequentially

如果愿意,可以将JSON输入文件用作数据文件,请参见此处

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.

这篇关于如何在邮递员中同时/顺序发送多个请求,每个请求具有不同的值集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆