1 Star 0 Fork 0

王路123456/bbb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
IHMRpostmancollection.json 11.15 KB
一键复制 编辑 原始数据 按行查看 历史
Your Name 提交于 2021-09-09 21:11 . Initial commit
{
"info": {
"_postman_id": "6ea667de-884a-4ee3-b1ce-18aa60a3cdae",
"name": "IHMR",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "参数化",
"item": [
{
"name": "登录成功",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(data.status_code);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(data.success);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(data.code);\r",
"});\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(data.message);\r",
"});\r",
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"// 把传入的请求体转化为字符串\r",
"var request_data = JSON.stringify(data.login_data)\r",
"\r",
"// 把转化之后的数据保存到环境变量中\r",
"pm.environment.set(\"request_data\", request_data)"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{{request_data}}\r\n"
},
"url": {
"raw": "{{base_url}}/api/sys/login",
"host": [
"{{base_url}}"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
}
]
},
{
"name": "登录成功",
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"13800000002\",\r\n \"password\": \"123456\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "不输入用户名",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\":\"\",\r\n \"password\": \"123456\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "用户名长度异常",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"138000000023\",\r\n \"password\": \"123456\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "未注册手机号",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"13800234545\",\r\n \"password\": \"123456\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "不输入密码",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"138000000023\",\r\n \"password\": \"123456\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "密码长度异常",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"138000000023\",\r\n \"password\": \"1234567\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
},
{
"name": "密码与账号不匹配",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.success).to.eql(false);\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.code).to.eql(20001);\r",
"});\r",
"\r",
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"错误\");\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "",
"value": "",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"mobile\": \"138000000023\",\r\n \"password\": \"1234\"\r\n}"
},
"url": {
"raw": "http://ihrm-test.itheima.net/api/sys/login",
"protocol": "http",
"host": [
"ihrm-test",
"itheima",
"net"
],
"path": [
"api",
"sys",
"login"
]
}
},
"response": []
}
]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang-lu-123456/bbb.git
[email protected]:wang-lu-123456/bbb.git
wang-lu-123456
bbb
bbb
master

搜索帮助