Commit 3ab7d57a by zhangjingdong

添加脚本日志

parent 1f8f0104
No preview for this file type
No preview for this file type
# coding = utf-8
# coding = utf-8
......@@ -9,6 +9,7 @@ class PostmanApi:
def post(self):
file = []
report_file = "/phantom/file/testreport/"
# report_file = "/Users/lucas/Documents/reporter/"
BASE_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
path = os.listdir(BASE_DIR)
delay_request = str(50)
......
{
{
......@@ -66,7 +66,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
......@@ -128,7 +128,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
......@@ -190,7 +190,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
......
{
{
......@@ -90,7 +90,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -160,7 +160,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -229,7 +229,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -282,7 +282,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -335,7 +335,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -385,7 +385,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -435,7 +435,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -506,7 +506,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -577,7 +577,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -647,7 +647,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -717,7 +717,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -770,7 +770,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -841,7 +841,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -920,7 +920,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -1079,7 +1079,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -1150,7 +1150,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -1221,7 +1221,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......@@ -1292,7 +1292,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
"pm.test(\"Response time is less than 3000ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(3000);",
......
{
{
{
"variables": [],
"info": {
"name": "APP推荐位",
"name": "推荐位",
"_postman_id": "a922a9c2-c0d4-8c50-45d4-2a54947151d8",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
......@@ -65,7 +65,7 @@
"if(jsonData.code === \"0\")",
"{",
" tests[\"accountId\"] = true;",
" postman.setEnvironmentVariable(\"account_Id\",jsonData.data.accessToken);",
" postman.setEnvironmentVariable(\"account_Id\",jsonData.data.accountId);",
" ",
"}"
]
......@@ -73,7 +73,7 @@
}
],
"request": {
"url": "{{gateway-user}}/user/userinfo/phone/{{user_phone}}",
"url": " {{gateway-user}}/user/userinfo/phone/{{user_phone}}",
"method": "GET",
"header": [],
"body": {},
......@@ -91,12 +91,13 @@
"exec": [
"var jsonData = JSON.parse(responseBody);",
"if(jsonData.code === \"0\")",
"if(jsonData.data !== null)",
"{",
" tests[\"code\"] = true;",
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
......@@ -140,7 +141,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
......@@ -168,6 +169,51 @@
"description": ""
},
"response": []
},
{
"name": "APP端分页查询科技小镇生活版推荐位可用信息 copy copy",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"if(jsonData.code === \"0\")",
"if(jsonData.data !== null)",
"{",
" tests[\"code\"] = true;",
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"+jsonData.msg]=false;",
"}"
]
}
}
],
"request": {
"url": "{{gateway-user}}/recommendation/town/app/list/by/condition/?p=1&c=20",
"method": "POST",
"header": [
{
"key": "access-token",
"value": "{{access-Token}}",
"description": ""
},
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"townId\": 58,\r\n \"accountId\": 90483,\r\n \"blockType\": \"EXIST\",\r\n \"range\": \"PAGE\",\r\n \"status\": \"ENABLE\"\r\n}"
},
"description": ""
},
"response": []
}
]
}
\ No newline at end of file
{
{
{
"id": "40b76b24-7adb-5356-18fe-c277e301adc0",
"name": "APP推荐位_manage",
"name": "推荐位_manage",
"values": [
{
"key": "gateway-user",
......@@ -10,13 +10,13 @@
},
{
"key": "user_phone",
"value": "13410480252",
"value": "13410480256",
"enabled": true,
"type": "text"
},
{
"key": "access-Token",
"value": "f061bdcbddc540c8869adf6ed92b5c9f",
"value": "bdfb9a3f9e8445649b49b1a9f027a769",
"enabled": true,
"type": "text"
},
......@@ -27,8 +27,8 @@
"type": "text"
}
],
"timestamp": 1545119358141,
"timestamp": 1545124453130,
"_postman_variable_scope": "environment",
"_postman_exported_at": "2018-12-18T08:44:25.323Z",
"_postman_exported_at": "2018-12-18T09:15:45.779Z",
"_postman_exported_using": "Postman/4.9.3"
}
\ No newline at end of file
{
{
......@@ -54,7 +54,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"userPhone\": {{user_phone}},\n \"userPassword\": \"123456\",\n \"equipment\": \"c5d93c486a95d658\",\n \"channelId\": 1\n}"
"raw": "{\n \"userPhone\": 18670340158,\n \"userPassword\": \"123456\",\n \"equipment\": \"c5d93c486a95d658\",\n \"channelId\": 1\n}"
},
"url": "{{gateway-user}}/app/login"
},
......@@ -76,7 +76,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -119,7 +119,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -172,7 +172,7 @@
{
"listen": "test",
"script": {
"id": "f008e296-82a3-4d20-a473-7c2827a257eb",
"id": "293b7219-35c2-4b3a-8dab-a90f193d0436",
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
......@@ -181,10 +181,11 @@
" tests[\"code\"] = true;",
"}",
"else{",
" tests[\"code\"+jsonData.msg]=false;",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
"}",
""
"",
"eval(globals.assert);"
]
}
}
......@@ -203,7 +204,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"activityId\":196,\n \"enrollStatus\": \"CONFIRM\",\n\n \"townId\": 1\n}"
"raw": "{\n \"activityId\":196,\n \"enrollStatus\": \"CONFIRM\",\n \"townId\": 1\n}"
},
"url": "{{gateway-user}}/app/new/activity/enroll"
},
......@@ -225,7 +226,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -268,7 +269,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -299,7 +300,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -335,7 +336,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......@@ -371,7 +372,7 @@
"}",
"else{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"code\"]=false;",
" tests[\"code\"+jsonData.msg]=false;",
"}",
""
]
......
{
{
......@@ -28,6 +28,6 @@
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2018-11-27T03:29:41.309Z",
"_postman_exported_at": "2018-12-18T11:08:37.386Z",
"_postman_exported_using": "Postman/6.1.4"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment