网站建设背景是什么,批量管理多个wordpress,加盟网站系统,个人网站备案名字postman使用
开发中经常用postman来测试接口#xff0c;一个简单的注册接口用postman测试#xff1a; 接口正常工作只是最基本的要求#xff0c;经常要评估接口性能#xff0c;进行压力测试。
postman进行简单压力测试
下面是压测数据源#xff0c;支持json和csv两个格…postman使用
开发中经常用postman来测试接口一个简单的注册接口用postman测试 接口正常工作只是最基本的要求经常要评估接口性能进行压力测试。
postman进行简单压力测试
下面是压测数据源支持json和csv两个格式如果包含有中文请将文件编码改为UTF-8(否则请求中文会乱码)
csv格式数据如下(txt文件) json格式如下 [{registerName: zhangsan0001,registerPwd: asd100001},{registerName: zhangsan0002,registerPwd: asd100002},{registerName: zhangsan0003,registerPwd: asd100003},{registerName: zhangsan0004,registerPwd: asd100004},{registerName: zhangsan0005,registerPwd: asd100005}
] 以csv格式数据为例json格式数据只需要在导入测试数据时选择json就可以
1、新建一个fodder在fodder下添加要进行压力测试的接口 2、post接口测试参数从txt导入
{{registerName}} 和 {{registerPwd}} 是模板参数 3、设置 Pre-request-Script 参数 postman.setEnvironmentVariable(registerName,data[registerName]); postman.setEnvironmentVariable(registerPwd,data[registerPwd]); 4、设置test便于观察测试结果 tests[Status code is 200] responseCode.code 200; tests[Response time is less than 10000ms] responseTime 10000; console.log(responseTime); 5、保存请求点击runner按如下设置
Delay设置每隔多少毫秒发一次请求。 Data File Type 选择 CSV点击预览可以看到 6、设置Iteration
预览Iteration一共有359行设置Iteration为 359 点击Run 7、测试结果 postman跑完全部测试用例按test给出了测试结果 B站2023年最详细的python自动化测试全栈测试开发技术入门到精通教程