{
"info": {
"_postman_id": "990bbd1c-8325-47b8-bb18-262ee88ec954",
"name": "Demo",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "用户登录操作",
"event": [
{
"listen": "test",
"script": {
"id": "30b57a53-f81e-4a24-9e4d-a502a4c7859b",
"exec": [
"if(responseCode.code === 200){\r",
" tests[\"请求正常\"] = responseCode.code === 200;\r",
"}else{\r",
" tests[\"请求正常异常【状态码为:200】\"] = responseCode.code === 200;\r",
"}\r",
"try {\r",
" var responseJSON = JSON.parse(responseBody); \r",
" if(responseJSON.biz.code !== 200){\r",
" tests[\"业务错误【\"+responseJSON.message.err_msg+\"】\"] = responseJSON.biz.code === 200;\r",
" }\r",
" else{\r",
" tests[\"业务正常\"] = responseJSON.biz.code === 200;\r",
" //只有登录和获取header值才需要下面的三个赋值\r",
" postman.setEnvironmentVariable('t', responseJSON.biz.data.t);\r",
" postman.setEnvironmentVariable('s', responseJSON.biz.data.s);\r",
" }\r",
"}\r",
"catch (e) { \r",
"}\r",
"if(responseTime < 200){\r",
" tests[\"响应小于200毫秒【\"+responseTime+\"毫秒】\"] = responseTime < 200;\r",
"}else{\r",
" tests[\"响应大于200毫秒【\"+responseTime+\"毫秒】\"] = responseTime < 200;\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "d",
"value": "{{d}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "Account",
"value": "13871625041",
"description": "手机号",
"type": "text"
},
{
"key": "Pwd",
"value": "123456",
"description": "密码",
"type": "text"
}
]
},
"url": {
"raw": "/login/Index",
"path": [
"login",
"Index"
]
},
"description": "返回参数中uid(用户编号),phone(用户手机号),total(总共此时),available(可用次数);说明:没进行一次模拟考试次数扣1,顺序练习扣5;主要是防止学员给其他人使用"
},
"response": []
},
{
"name": "模拟考试类别",
"request": {
"method": "POST",
"header": [
{
"key": "d",
"value": "{{d}}",
"type": "text"
},
{
"key": "t",
"value": "{{t}}",
"type": "text"
},
{
"key": "s",
"value": "{{s}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": "/Exam/SJobType",
"path": [
"Exam",
"SJobType"
]
},
"description": "返回当前登录学员可以模拟考试的类别"
},
"response": []
}
]
}