post man 参数

postman 参数化:

前置处理器(Pre-requestScriptest):

postman.setGlobalVariable("key","value");

body中使用:"{{key}}"

 

后置处理器:

如果是标准接口返回的json

可以在后置处理器(Tests)中添加:

jsonData = JSON.parse(responseBody);

postman.setGlobalVariable("caseId", jsonData.data.caseId);
postman.setGlobalVariable("userId", jsonData.data.userId);

 

随机函数

{{$guid}}:添加一个V4风格GUID(如: aa002-44ac-45ca-aae3-52bf19650e2d)

{{$timestamp}}:将当前的时间戳,精确到秒

{{$randomInt}}:添加0和1000之间的随机整数

posted @ 2020-04-27 16:31  ChenduLaoWang  阅读(708)  评论(0)    收藏  举报