postman
文章平均质量分 67
postman
小福气_
这个作者很懒,什么都没留下…
展开
-
postman常用方法集合
1.设置环境变量 postman.setEnvironmentVariable("key", "value"); //postman 5.0以上版本设置环境变量的方法 pm.environment.get("key", "value"); 2.设置全局变量 postman.setGlobalVariable("key", "value"); //postman 5.0以上版本设置...原创 2020-01-03 18:03:30 · 322 阅读 · 0 评论 -
存取环境变量
1、存储token值 var jsonData =JSON.parse(responseBody);//获取body中返回的所有参数 postman.setEnvironmentVariable("token",jsonData.data.info.token);//把返回参数中的keys设置为环境变量 2、取用token值 ...原创 2020-01-03 15:26:32 · 125 阅读 · 0 评论 -
postman自动化测试-Tests
// 检查格式 pm.test("response 应该包含 code,data,message", function () { pm.expect(pm.response.text()).to.include("code"); pm.expect(pm.response.text()).to.include("data"); pm.expect(pm.re...原创 2020-01-03 15:22:02 · 205 阅读 · 0 评论 -
Pre-request Script
// 项目名称 function getGuid () { var d = new Date().getTime() var guid = 'xxxx-xxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0 d = Math.floor(d / 16) ret...原创 2020-01-03 15:19:40 · 296 阅读 · 0 评论