Commit 1274e8d8 by zhangjingdong

添加脚本

parent e3055871
No preview for this file type
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="243b24f3-3df7-4c72-bf73-8de81d5ca458" name="Default" comment=""> <list default="true" id="243b24f3-3df7-4c72-bf73-8de81d5ca458" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/碧合app/execute_automation_scripts.py" beforeDir="false" afterPath="$PROJECT_DIR$/碧合app/execute_automation_scripts.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/碧合app/execute_automation_scripts.py" beforeDir="false" afterPath="$PROJECT_DIR$/碧合app/execute_automation_scripts.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/碧合app/活动/-活动_manage.postman_environment.json" beforeDir="false" afterPath="$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
...@@ -12,15 +14,15 @@ ...@@ -12,15 +14,15 @@
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="CoverageDataManager"> <component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/bihe_interface_test$execute_automation_scripts.coverage" NAME="execute_automation_scripts Coverage Results" MODIFIED="1543544423737" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/碧合app" /> <SUITE FILE_PATH="coverage/bihe_interface_test$execute_automation_scripts.coverage" NAME="execute_automation_scripts Coverage Results" MODIFIED="1544607852384" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/碧合app" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="execute_automation_scripts.py" pinned="false" current-in-tab="true"> <file leaf-file-name="execute_automation_scripts.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"> <entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-124"> <state relative-caret-position="198">
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" /> <caret line="11" column="49" lean-forward="true" selection-start-line="11" selection-start-column="49" selection-end-line="11" selection-end-column="49" />
<folding> <folding>
<element signature="e#18#29#0" expanded="true" /> <element signature="e#18#29#0" expanded="true" />
</folding> </folding>
...@@ -38,8 +40,8 @@ ...@@ -38,8 +40,8 @@
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
</file> </file>
<file leaf-file-name="-活动_manage.postman_environment.json" pinned="false" current-in-tab="false"> <file leaf-file-name="活动_manage.postman_environment.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/碧合app/活动/-活动_manage.postman_environment.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
</file> </file>
...@@ -71,7 +73,7 @@ ...@@ -71,7 +73,7 @@
<component name="NodePackageJsonFileManager"> <component name="NodePackageJsonFileManager">
<packageJsonPaths /> <packageJsonPaths />
</component> </component>
<component name="ProjectFrameBounds" fullScreen="true"> <component name="ProjectFrameBounds" extendedState="6" fullScreen="true">
<option name="width" value="1440" /> <option name="width" value="1440" />
<option name="height" value="900" /> <option name="height" value="900" />
</component> </component>
...@@ -91,7 +93,18 @@ ...@@ -91,7 +93,18 @@
<path> <path>
<item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" /> <item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" />
<item name="bihe_interface_test" type="462c0819:PsiDirectoryNode" /> <item name="bihe_interface_test" type="462c0819:PsiDirectoryNode" />
<item name="venv" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" />
<item name="bihe_interface_test" type="462c0819:PsiDirectoryNode" />
<item name="碧合app" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" />
<item name="bihe_interface_test" type="462c0819:PsiDirectoryNode" />
<item name="碧合app" type="462c0819:PsiDirectoryNode" /> <item name="碧合app" type="462c0819:PsiDirectoryNode" />
<item name="活动" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path> <path>
<item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" /> <item name="bihe_interface_test" type="b2602c69:ProjectViewProjectNode" />
...@@ -169,9 +182,9 @@ ...@@ -169,9 +182,9 @@
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="7" /> <window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Python Console" order="7" /> <window_info anchor="bottom" id="Python Console" order="7" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32969698" /> <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.32969698" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.32969698" /> <window_info anchor="bottom" id="Terminal" order="7" weight="0.32969698" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25679544" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26037195" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="3" /> <window_info anchor="right" id="Database" order="3" />
<window_info anchor="right" id="SciView" order="3" /> <window_info anchor="right" id="SciView" order="3" />
...@@ -208,6 +221,25 @@ ...@@ -208,6 +221,25 @@
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"> <entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
<folding>
<element signature="e#18#29#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/碧合app/活动/活动.postman_collection.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="234"> <state relative-caret-position="234">
<caret line="14" column="25" selection-start-line="14" selection-start-column="25" selection-end-line="14" selection-end-column="25" /> <caret line="14" column="25" selection-start-line="14" selection-start-column="25" selection-end-line="14" selection-end-column="25" />
<folding> <folding>
...@@ -222,14 +254,14 @@ ...@@ -222,14 +254,14 @@
<entry file="file://$PROJECT_DIR$/碧合app/活动/活动.postman_collection.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动.postman_collection.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/碧合app/活动/-活动_manage.postman_environment.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/htmlOut.html" /> <entry file="file://$PROJECT_DIR$/htmlOut.html" />
<entry file="file://$PROJECT_DIR$/碧合app/活动/活动.postman_collection.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动.postman_collection.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/碧合app/活动/-活动_manage.postman_environment.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"> <entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py">
...@@ -243,7 +275,7 @@ ...@@ -243,7 +275,7 @@
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/htmlOut.html" /> <entry file="file://$PROJECT_DIR$/htmlOut.html" />
<entry file="file://$PROJECT_DIR$/碧合app/活动/-活动_manage.postman_environment.json"> <entry file="file://$PROJECT_DIR$/碧合app/活动/活动_manage.postman_environment.json">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/README.md"> <entry file="file://$PROJECT_DIR$/README.md">
...@@ -259,8 +291,8 @@ ...@@ -259,8 +291,8 @@
<entry file="file://$PROJECT_DIR$/碧合app/活动2018-11-28_09:34:00.html" /> <entry file="file://$PROJECT_DIR$/碧合app/活动2018-11-28_09:34:00.html" />
<entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"> <entry file="file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-124"> <state relative-caret-position="198">
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" /> <caret line="11" column="49" lean-forward="true" selection-start-line="11" selection-start-column="49" selection-end-line="11" selection-end-column="49" />
<folding> <folding>
<element signature="e#18#29#0" expanded="true" /> <element signature="e#18#29#0" expanded="true" />
</folding> </folding>
......
# coding = utf-8 # coding = utf-8
...@@ -9,8 +9,11 @@ class PostmanApi: ...@@ -9,8 +9,11 @@ class PostmanApi:
def post(self): def post(self):
file = [] file = []
report_file = "/phantom/file/testreport/" report_file = "/phantom/file/testreport/"
# report_file = "/Users/lucas/Documents/报告地址/"
BASE_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
path = os.listdir(BASE_DIR) path = os.listdir(BASE_DIR)
delay_request = str(50)
timeout_request= str(5000)
# print( path) # print( path)
for p in path: for p in path:
if os.path.isdir(p): if os.path.isdir(p):
...@@ -18,24 +21,24 @@ class PostmanApi: ...@@ -18,24 +21,24 @@ class PostmanApi:
for file_path in file: for file_path in file:
now_date = report_file + time.strftime("%Y-%m-%d", time.localtime(time.time())) now_date = report_file + time.strftime("%Y-%m-%d", time.localtime(time.time()))
now_module = now_date + "/" + file_path now_module = now_date + "/" + file_path
now_time = now_date + "/" + file_path + "/" + time.strftime("%H%M%S", time.localtime( now_time = now_date + "/" + file_path + "/" + time.strftime("%H-%M", time.localtime(
time.time())) + "_" + file_path + '.html' time.time())) + "_" + file_path + '.html'
if (os.path.exists(now_date)): if (os.path.exists(now_date)):
if (os.path.exists(now_module)): if (os.path.exists(now_module)):
execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/-" + file_path + "_manage.postman_environment.json --delay-request 500 --timeout-request 5000 --reporters html --reporter-html-export " + now_time execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/" + file_path + "_manage.postman_environment.json --delay-request "+delay_request+" --timeout-request "+timeout_request+" --reporters html --reporter-html-export " + now_time
os.system(execute) os.system(execute)
else: else:
os.system("mkdir " + now_module) os.system("mkdir " + now_module)
execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/-" + file_path + "_manage.postman_environment.json --delay-request 500 --timeout-request 5000 --reporters html --reporter-html-export " + now_time execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/" + file_path + "_manage.postman_environment.json --delay-request "+delay_request+" --timeout-request "+timeout_request+" --reporters html --reporter-html-export " + now_time
os.system(execute) os.system(execute)
else: else:
os.system("mkdir " + now_date) os.system("mkdir " + now_date)
if (os.path.exists(now_module)): if (os.path.exists(now_module)):
execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/-" + file_path + "_manage.postman_environment.json --delay-request 500 --timeout-request 5000 --reporters html --reporter-html-export " + now_time execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/" + file_path + "_manage.postman_environment.json --delay-request "+delay_request+" --timeout-request "+timeout_request+" --reporters html --reporter-html-export " + now_time
os.system(execute) os.system(execute)
else: else:
os.system("mkdir " + now_module) os.system("mkdir " + now_module)
execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/-" + file_path + "_manage.postman_environment.json --delay-request 500 --timeout-request 5000 --reporters html --reporter-html-export " + now_time execute = "newman run " + BASE_DIR + "/" + file_path + "/" + file_path + ".postman_collection.json -e " + BASE_DIR + "/" + file_path + "/" + file_path + "_manage.postman_environment.json --delay-request "+delay_request+" --timeout-request "+timeout_request+" --reporters html --reporter-html-export " + now_time
os.system(execute) os.system(execute)
return self return self
......
{
{
"info": {
"_postman_id": "2a3c1f0c-37b1-4c06-9f2f-a378571047d6",
"name": "企业墙",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "用户登录",
"event": [
{
"listen": "test",
"script": {
"id": "ab616fda-d96b-4f71-a9aa-6c59ce279e71",
"type": "text/javascript",
"exec": [
"// console.log(\"----------------responseBody--------------\"+responseBody);",
"var jsonData = JSON.parse(responseBody);",
"// console.log(\"----------------jsonData.data.accessToken--------------\"+jsonData.data.accessToken);",
"",
"if(jsonData.data !== null || jsonData.data !==\"\")",
"{",
" tests[\"accessToken\"] = true;",
" postman.setEnvironmentVariable(\"access-Token\",jsonData.data.accessToken);",
" ",
"}",
"else",
"{",
" console.log(\"接口返回错误:\"+jsonData.msg);",
" tests[\"accessToken\"]=false;",
"}",
""
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"userPhone\": {{user_phone}},\n \"userPassword\": \"123456\",\n \"equipment\": \"c5d93c486a95d658\",\n \"channelId\": 1\n}"
},
"url": "{{gateway-user}}/app/login"
},
"response": []
},
{
"name": "APP根据类型查询企业列表",
"request": {
"method": "POST",
"header": [
{
"key": "access-Token",
"value": "{{access-Token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"townId\": 1,\n \"id\": \"\"\n}"
},
"url": {
"raw": "{{gateway-user}}/enterprise/wall/type?p=1&c=10",
"host": [
"{{gateway-user}}"
],
"path": [
"enterprise",
"wall",
"type"
],
"query": [
{
"key": "p",
"value": "1"
},
{
"key": "c",
"value": "10"
}
]
}
},
"response": []
},
{
"name": "APP 获取企业详情",
"event": [
{
"listen": "test",
"script": {
"id": "abd52a73-7a0b-470d-bd6b-26b308776215",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "access-Token",
"value": "{{access-Token}}"
}
],
"body": {},
"url": "{{gateway-user}}/enterprise/wall/{{id}}"
},
"response": []
}
]
}
\ No newline at end of file
{
{
"id": "8696c47e-61ac-4e1c-915a-403b5b20c36e",
"name": "企业墙_manage",
"values": [
{
"key": "gateway-user",
"value": "https://usergwtest.bgycc.com",
"enabled": true,
"type": "text"
},
{
"key": "user_phone",
"value": "17610939089",
"enabled": true,
"type": "text"
},
{
"key": "access-Token",
"value": "d0623a906fac4f1bb9c410680eced5ef",
"enabled": true,
"type": "text"
},
{
"key": "townId",
"value": "1",
"enabled": true,
"type": "text"
},
{
"key": "id",
"value": "289",
"enabled": true,
"type": "text"
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2018-12-12T07:51:18.360Z",
"_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