一、接口调试
1、单接口调试(直接点击右方Send发送执行)
2、多接口调式(可以点击下方图中进入)
A、
B、
二、Postman数据驱动(基于CSV和JSON文件)
1 if(responseBody.search("access_token")!=‐1){
2 //通过返回的结果匹配一个正则表达式去得到需要的值
3 var datas = responseBody.match(newRegExp('"access_token":"(.*?)"'));
4
5 //设置为全局变量
6 pm.globals.set("access_token",datas[1]);
7
8 //业务断言:检查返回的结果中包含有access_token字符串
9 pm.test("检查返回的结果中包含有access_token字符串", function() {
10 pm.expect(pm.response.text()).to.include("access_token");
11 });
12 }
如果返回的结果不等于-1说明有查询到值。等于-1说明没有查找到值。
csv
1 grant_type,appid,secret
2 client_credential,wx74a8627810cfa308,e40a02f9d79a8097df497e6aaf93ab80
3,wx74a8627810cfa308,e40a02f9d79a8097df497e6aaf93ab80
4 client_credential,,e40a02f9d79a8097df497e6aaf93ab80
5 client_credential,wx74a8627810cfa308,
json
1 [
2
{"grant_type":"client_credential","appid":"wx74a8627810cfa308","secret":"e40a02f9d79a8097df497e6aaf93ab80"},
3 {"grant_type":"","appid":"wx74a8627810cfa308","secret":"e40a02f9d79a8097df497e6aaf93ab80"},
4 {"grant_type":"client_credential","appid":"","secret":"e40a02f9d79a8097df497e6aaf93ab80"},
5
{"grant_type":"client_credential","appid":"wx74a8627810cfa308","secret":""}