由于所有Postman集合基本上都是.json文件,因此很难通过代码查看工具来查看用Postman编写的代码。
此刻,我继续在GitHub上查看此类.json文件,但这并不十分方便。
例如,这是一些以.json格式发送以供审查的JS代码
"listen": "test",
"script": {
"id": "e8f64f04-8ca5-4b5a-8333-1f6bde73cf0c",
"exec": [
"var body = xml2Json(responseBody);",
"// const resp = pm.response.json();",
"let resp = body.projects;",
"var b = \"New_Poject_e2e\"+pm.environment.get(\"random_number\");",
" console.log(b);",
"for (var i = 0; i < resp.project.length; i++)",
"{",
" if (resp.project[i].name === b)",
" {",
" console.log(resp.project[i].id[\"_\"]);",
" pm.environment.set(\"projID\", resp.project[i].id[\"_\"]);",
" }",
"}",
""
],
"type": "text/javascript"
}
是否存在有效的方法来对邮递员集合的预请求脚本,请求和测试进行代码审查?
答案 0 :(得分:1)
您是否尝试过创建Collection的fork?
https://learning.getpostman.com/docs/postman/collections/version_control/#forking-a-collection
您可以在Forked Collection中进行更改,然后进行合并-在合并之前,您进入了Web视图,这可能会使这些差异更加容易。