Good News
JMeter中的参数化方法
上一篇 /
下一篇 2022-01-19 10:23:02
准备好CSV文件,里面有2列数据,分别是 id 和 type。
在CSV Data Set Config中设置变量名: id 和 type。
在Http Request 中,选择HTTP Request 为POST,选择Body Data
输入:
{
"page": 0,
"size": 200,
"userId": ${userId},
"userType": ${userType}
}
就可以实现顺序读取CSV文件内容,做参数化了。
修正:我在实际测试中,发现直接在HTTP Request 中的 Body Data,用参数无效所以我在Bean Shell PreProcessor 中加入以下java代码,测试通过:String userId = "${id}";String userType = "${type}";vars.put("userId",userId);vars.put("userType",userType);
收藏
举报
TAG: