Pre-request Script常用代码

2020-06-08  本文已影响0人  lalalasa
//设置环境变量
pm.globles.set(key, value);  

//发送一个请求
pm.sendRequest("http://www.baidu.com", function(err, response){
console.log(response.json());
});  

// js数组长度
var arr =['aa','dd','bb','cc'];
console.log(arr.length);

//查看变量字符类型

有几个比较有意思的用法,如果使用postman做自动化工具,这几个语法可以参考使用

//设置下一步被执行的请求
postman.setNextRequest("request_name");

参考文档:https://learning.postman.com/docs/postman/scripts/postman-sandbox-api-reference/

上一篇 下一篇

猜你喜欢

热点阅读