门户网站建设 报告,网站建设有创意,牛商网做网站要多少钱,教育培训机构加盟文章目录 IntroPostman usagePre-request ScriptTests javascripts API Intro
这一切都是为了增加自动化动作所占的比例#xff08;减少人手工操作复制粘贴可能会造成的错误#xff09;。
Postman usage
最常用的#xff1a;选HTTP方法类型、写URL#xff0c;在Headers中… 文章目录 IntroPostman usagePre-request ScriptTests javascripts API Intro
这一切都是为了增加自动化动作所占的比例减少人手工操作复制粘贴可能会造成的错误。
Postman usage
最常用的选HTTP方法类型、写URL在Headers中填请求头在Body中填请求体。
Pre-request Script 和 Tests 是干什么用的先看执行顺序
Pre-request Script
https://learning.postman.com/docs/writing-scripts/pre-request-scripts/
Tests
https://learning.postman.com/docs/writing-scripts/test-scripts/
javascripts API
// 获取某个环境变量
pm.environment.get(环境变量名)// Tests 中获取 responseBody
var resp pm.response.json();
// 把response中的某个字段设置到某个环境变量中
pm.environment.set(环境变量名, resp.XXX);之后在其他请求中要引用这个environment的话语法如下
见 https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#using-environment-variables-in-scripts