From 1f5baa57166664f3c0fd6a55267f4af4089dbdcf Mon Sep 17 00:00:00 2001 From: xiao-hesheng Date: Wed, 11 Oct 2023 17:22:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=A2=E5=8C=BA=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E9=99=A2=E5=8C=BA=E6=9F=A5=E8=AF=A2=20=E9=99=A2=E5=8C=BA?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...41\347\220\206\351\241\265\351\235\242.py" | 2 +- ...42\345\214\272\346\226\260\345\242\236.py" | 55 +++++++++++++++++++ ...45\350\257\242\351\231\242\345\214\272.py" | 53 ++++++++++++++++++ common/fileUtls.py | 21 +++++++ data/a2_herp3_bs/data | 28 +++++++--- report/summary.html | 4 +- 6 files changed, 153 insertions(+), 10 deletions(-) create mode 100644 "air_case/a2_herp3_bs/a4_\351\231\242\345\214\272\346\226\260\345\242\236.air/a4_\351\231\242\345\214\272\346\226\260\345\242\236.py" create mode 100644 "air_case/a2_herp3_bs/a5_\346\237\245\350\257\242\351\231\242\345\214\272.air/a5_\346\237\245\350\257\242\351\231\242\345\214\272.py" diff --git "a/air_case/a2_herp3_bs/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.air/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.py" "b/air_case/a2_herp3_bs/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.air/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.py" index 777b943d..aeb41ccd 100644 --- "a/air_case/a2_herp3_bs/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.air/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.py" +++ "b/air_case/a2_herp3_bs/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.air/a3\351\231\242\345\214\272\347\256\241\347\220\206\351\241\265\351\235\242.py" @@ -27,7 +27,7 @@ def hospital_area(): # 获取token和projectCode token,projectCode,uxid,corpId,info= login_system(username, password).get_token() # print( token,projectCode,uxid,corpId,info) - #医院信息登记接口 + #a3院区管理页面 url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "5ce279bb138a4261828289ae834ed53a_url") # print(url) # 获取请求头信息 diff --git "a/air_case/a2_herp3_bs/a4_\351\231\242\345\214\272\346\226\260\345\242\236.air/a4_\351\231\242\345\214\272\346\226\260\345\242\236.py" "b/air_case/a2_herp3_bs/a4_\351\231\242\345\214\272\346\226\260\345\242\236.air/a4_\351\231\242\345\214\272\346\226\260\345\242\236.py" new file mode 100644 index 00000000..a39ff9cf --- /dev/null +++ "b/air_case/a2_herp3_bs/a4_\351\231\242\345\214\272\346\226\260\345\242\236.air/a4_\351\231\242\345\214\272\346\226\260\345\242\236.py" @@ -0,0 +1,55 @@ +# -*- encoding=utf8 -*- + +__author__ = "xiaohesheng" + +""" +case_tag:api,mdm-web,a4_院区新增,id2263,id2263-4,sit,on +主数据平台:a4_院区新增 +""" + +from common.common_func import commonFuc +from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system +from airtest.core.api import using +import sys +from common.fileUtls import FileUtils +module = "a2_herp3_bs" +def branch_add(): + """ + 场景:a4_院区新增 + 用例名称:a4_院区新增 + 输入:无 + 输出:"rtn_msg": {"code": 0, "msg": null, "data": true} + """ + #内网登录 + username = commonFuc().get_business_data(module, "username") + # print('医院名称',username) + password = commonFuc().get_business_data(module, "password") + # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') + # 获取token和projectCode + token,projectCode,uxid,corpId,info= login_system(username, password).get_token() + # print( token,projectCode,uxid,corpId,info) + #a4_院区新增 + url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "insert_url") + # print(url) + # 获取请求头信息 + headers = commonFuc().get_business_data(module, "json_headers2", + commonFuc().get_business_data(module, "json_contentType"), token, + commonFuc().get_business_data(module, "X-APP-CODE")) + name=commonFuc().randomString(5) + #请求体 + request_body=commonFuc().get_business_data(module, "payload",name,name) + + # 发送请求 + result = commonFuc().http_post(url, request_body,headers) + print('result', result) + #断言 + code=commonFuc().analysis_json('code',result) + commonFuc().check_text_exist(0,result) + id1=commonFuc().analysis_json('id',commonFuc().analysis_json('data',result)) + name=commonFuc().analysis_json('name',commonFuc().analysis_json('data',result)) + + # print(id1,name,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') + return id1,name +id2,name=branch_add() +info=(id2,name) +FileUtils().w_info2(info,module,'院区新增') \ No newline at end of file diff --git "a/air_case/a2_herp3_bs/a5_\346\237\245\350\257\242\351\231\242\345\214\272.air/a5_\346\237\245\350\257\242\351\231\242\345\214\272.py" "b/air_case/a2_herp3_bs/a5_\346\237\245\350\257\242\351\231\242\345\214\272.air/a5_\346\237\245\350\257\242\351\231\242\345\214\272.py" new file mode 100644 index 00000000..8079bc7b --- /dev/null +++ "b/air_case/a2_herp3_bs/a5_\346\237\245\350\257\242\351\231\242\345\214\272.air/a5_\346\237\245\350\257\242\351\231\242\345\214\272.py" @@ -0,0 +1,53 @@ +# -*- encoding=utf8 -*- + +__author__ = "xiaohesheng" + +""" +case_tag:api,mdm-web,a5_查询院区,id2263,id2263-5,sit,on +主数据平台:a5_查询院区 +""" + +from common.common_func import commonFuc +from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system +from airtest.core.api import using +import sys +from common.fileUtls import FileUtils +module = "a2_herp3_bs" +def branch_select(): + """ + 场景:a5_查询院区 + 用例名称:a5_查询院区 + 输入:无 + 输出:"rtn_msg": {"code": 0, "msg": null, "data": true} + """ + #内网登录 + username = commonFuc().get_business_data(module, "username") + # print('医院名称',username) + password = commonFuc().get_business_data(module, "password") + # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') + # 获取token和projectCode + token,projectCode,uxid,corpId,info= login_system(username, password).get_token() + # print( token,projectCode,uxid,corpId,info) + #a5_查询院区 + url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "page_url") + # print(url) + # 获取请求头信息 + headers = commonFuc().get_business_data(module, "json_headers2", + commonFuc().get_business_data(module, "json_contentType"), token, + commonFuc().get_business_data(module, "X-APP-CODE")) + branch_name=FileUtils().r_info(module,'院区新增')["branch_name"] + # print(branch_name) + #请求体 + request_body=commonFuc().get_business_data(module, "payload1",branch_name) + + # 发送请求 + result = commonFuc().http_post(url, request_body,headers) + print('result', result) + #断言 + code=commonFuc().analysis_json('code',result) + commonFuc().check_text_exist(0,result) + id1=commonFuc().analysis_json('id',commonFuc().analysis_json('data',result)) + name=commonFuc().analysis_json('name',commonFuc().analysis_json('data',result)) + commonFuc().check_text_exist(id1,result) + commonFuc().check_text_exist(name, result) +branch_select() \ No newline at end of file diff --git a/common/fileUtls.py b/common/fileUtls.py index 36e99907..a9054bb6 100644 --- a/common/fileUtls.py +++ b/common/fileUtls.py @@ -53,6 +53,27 @@ class FileUtils(object): with open(yamlpath, "w", encoding="utf-8") as f: yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True) + def w_info2(self, info,module,keyname): + module=module + dict = {} + value = {} + value['branch_id'] = info[0] + value['branch_name'] = info[1] + key=keyname + dict[key] = value + w_path=rootPath+os.sep+'data'+os.sep+module + # print(w_path) + yamlpath = os.path.join(w_path, "message") + if (self.r_info(module,keyname)!=None): + # 写入到yaml文件 + with open(yamlpath, "w", encoding="utf-8") as f: + yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True) + else: + # 写入到yaml文件 + with open(yamlpath, "a", encoding="utf-8") as f: + yaml.dump(dict, f, Dumper=yaml.RoundTripDumper, allow_unicode=True) + + if __name__ == '__main__': # info=("aaaa","bbbbbb","mdm3-pim") diff --git a/data/a2_herp3_bs/data b/data/a2_herp3_bs/data index b030c1a0..8aeb3e03 100644 --- a/data/a2_herp3_bs/data +++ b/data/a2_herp3_bs/data @@ -2,7 +2,8 @@ "9ea057742d4a406a9220b7113f81f61a_url": "/hospitaltest2api/platformService/sys/user/v2/permission/9ea057742d4a406a9220b7113f81f61a/" "edit_h_info_url": "/hospitaltest2api/platformService/basic/company/detail/" "5ce279bb138a4261828289ae834ed53a_url": "/hospitaltest2api/platformService/sys/user/v2/permission/5ce279bb138a4261828289ae834ed53a/" - +"insert_url": "/hospitaltest2api/platformService/basic/branch/insert/" +"page_url": "/hospitaltest2api/platformService/basic/branch/page/" "username": "xhs1009" "password": "1qaz!QAZ" "X-APP-CODE": "herp.pc" @@ -16,13 +17,26 @@ json_headers2: { "X-APP-CODE":"%s" } "payload": { - "username": "%s", - "passwd": "%s", - "verifyCodeId": "%s", - "verifyCode": "", - "projectCode": "hdi.pc" - + "name": "东土城路院区%s", + "province": "11", + "city": "1101", + "area": "110101", + "mainBranch": "0", + "tbStatus": "1", + "hosId": "h0347", + "ybFlag": "0", + "address": "东土城路院区%s" } +"payload1": { + "pageNum": 1, + "pageSize": 50, + "orderBy": "bi.create_time desc", + "queryObject": { + "name": "%s", + "hosId": "h0347" + } +} + "payload2": { "sessionId": "%s", "uxid": "%s", diff --git a/report/summary.html b/report/summary.html index 72441032..faa7b899 100644 --- a/report/summary.html +++ b/report/summary.html @@ -72,9 +72,9 @@ - a3院区管理页面 + a5_查询院区 成功 - 0.778 + 0.726 xiaohesheng -- GitLab