Commit b854fed5 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 3ac4b4c0
......@@ -28,37 +28,38 @@ request_body = commonFuc().get_business_data(module, "payload7")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院信息
statisticProvince = result["data"]["list"][hosp_random]["statisticProvince"]
statisticRegion = result["data"]["list"][hosp_random]["statisticRegion"]
hospInfo = result["data"]["list"][hosp_random]["hospCode"]
if result["data"]["list"]:
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院信息
statisticProvince = result["data"]["list"][hosp_random]["statisticProvince"]
statisticRegion = result["data"]["list"][hosp_random]["statisticRegion"]
hospInfo = result["data"]["list"][hosp_random]["hospCode"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url8")
request_body = commonFuc().get_business_data(module, "payload8", statisticProvince, statisticRegion, hospInfo)
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url8")
request_body = commonFuc().get_business_data(module, "payload8", statisticProvince, statisticRegion, hospInfo)
"""
场景: 列表查询条件验证_医院列表
用例名称:列表查询条件验证_医院列表
输出:{"hospInfo":"%s"}
"""
"""
场景: 列表查询条件验证_医院列表
用例名称:列表查询条件验证_医院列表
输出:{"hospInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取医院信息
result = json.loads(result.content)
result = {"hospInfo": result["data"]["list"][0]["hospCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取医院信息
result = json.loads(result.content)
result = {"hospInfo": result["data"]["list"][0]["hospCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8", hospInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8", hospInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,43 +28,44 @@ request_body = commonFuc().get_business_data(module, "payload1")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
if result["data"]["list"]:
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院植入上报信息
source = (result["data"]["list"][hosp_random]["source"] if result["data"]["list"][hosp_random]["source"] else "")
statisticYear = result["data"]["list"][hosp_random]["statisticYear"]
statisticMonth = result["data"]["list"][hosp_random]["statisticMonth"]
invoiceCode = result["data"]["list"][hosp_random]["invoiceCode"]
hospInfo = result["data"]["list"][hosp_random]["hospitalCode"]
goodsInfo = result["data"]["list"][hosp_random]["customerCode"]
# 获取医院植入上报信息
source = (result["data"]["list"][hosp_random]["source"] if result["data"]["list"][hosp_random]["source"] else "")
statisticYear = result["data"]["list"][hosp_random]["statisticYear"]
statisticMonth = result["data"]["list"][hosp_random]["statisticMonth"]
invoiceCode = result["data"]["list"][hosp_random]["invoiceCode"]
hospInfo = result["data"]["list"][hosp_random]["hospitalCode"]
goodsInfo = result["data"]["list"][hosp_random]["customerCode"]
# 第三步进行列表查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2", source, statisticYear, statisticMonth,
invoiceCode, hospInfo, goodsInfo)
# print(request_body)
"""
场景: 列表查询条件验证_医院植入上报列表
用例名称:列表查询条件验证_医院植入上报列表
输出:{"invoiceCode":"%s"}
"""
# 第三步进行列表查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2", source, statisticYear, statisticMonth,
invoiceCode, hospInfo, goodsInfo)
# print(request_body)
"""
场景: 列表查询条件验证_医院植入上报列表
用例名称:列表查询条件验证_医院植入上报列表
输出:{"invoiceCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取医院植入上报信息
result = json.loads(result.content)
# print(result)
result = {"invoiceCode": result["data"]["list"][0]["invoiceCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取医院植入上报信息
result = json.loads(result.content)
# print(result)
result = {"invoiceCode": result["data"]["list"][0]["invoiceCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2", invoiceCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2", invoiceCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,36 +28,37 @@ request_body = commonFuc().get_business_data(module, "payload23")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
date_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取发票截至日期信息
statisticMonth = result["data"]["list"][date_random]["statisticMonth"]
statisticYear = result["data"]["list"][date_random]["statisticYear"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url24")
request_body = commonFuc().get_business_data(module, "payload24", statisticMonth, statisticYear)
"""
if result["data"]["list"]:
# 生成随机数
date_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取发票截至日期信息
statisticMonth = result["data"]["list"][date_random]["statisticMonth"]
statisticYear = result["data"]["list"][date_random]["statisticYear"]
场景: 列表查询条件验证_发票截至日期信息列表
用例名称:列表查询条件验证_发票截至日期信息列表
输出:{"statisticYear":"%s"}
"""
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url24")
request_body = commonFuc().get_business_data(module, "payload24", statisticMonth, statisticYear)
"""
场景: 列表查询条件验证_发票截至日期信息列表
用例名称:列表查询条件验证_发票截至日期信息列表
输出:{"statisticYear":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取发票截至日期信息
result = json.loads(result.content)
result = {"statisticYear": result["data"]["list"][0]["statisticYear"]}
# 获取发票截至日期信息
result = json.loads(result.content)
result = {"statisticYear": result["data"]["list"][0]["statisticYear"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict24", statisticYear)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict24", statisticYear)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,36 +28,37 @@ request_body = commonFuc().get_business_data(module, "payload20")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
goodsInfo = result["data"]["list"][good_random]["productCode"]
productLineName = result["data"]["list"][good_random]["productLineName"]
keynoteSpec = result["data"]["list"][good_random]["keynoteSpec"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url21")
request_body = commonFuc().get_business_data(module, "payload21", goodsInfo, productLineName, keynoteSpec)
"""
if result["data"]["list"]:
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
goodsInfo = result["data"]["list"][good_random]["productCode"]
productLineName = result["data"]["list"][good_random]["productLineName"]
keynoteSpec = result["data"]["list"][good_random]["keynoteSpec"]
场景: 列表查询条件验证_商品信息列表
用例名称:列表查询条件验证_商品信息列表
输出:{"goodsInfo":"%s"}
"""
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url21")
request_body = commonFuc().get_business_data(module, "payload21", goodsInfo, productLineName, keynoteSpec)
"""
场景: 列表查询条件验证_商品信息列表
用例名称:列表查询条件验证_商品信息列表
输出:{"goodsInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取商品信息
result = json.loads(result.content)
result = {"goodsInfo": result["data"]["list"][0]["productCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21", goodsInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取商品信息
result = json.loads(result.content)
result = {"goodsInfo": result["data"]["list"][0]["productCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21", goodsInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,37 +28,38 @@ request_body = commonFuc().get_business_data(module, "payload12")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取大区省份信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticRegion = result["data"]["list"][pro_random]["statisticRegion"]
if result["data"]["list"]:
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取大区省份信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticRegion = result["data"]["list"][pro_random]["statisticRegion"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13", statisticProvince, statisticRegion)
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13", statisticProvince, statisticRegion)
"""
场景: 列表查询条件验证_大区省份列表
用例名称:列表查询条件验证_大区省份列表
输出:{"statisticProvince":"%s"}
"""
"""
场景: 列表查询条件验证_大区省份列表
用例名称:列表查询条件验证_大区省份列表
输出:{"statisticProvince":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取大区省份信息
result = json.loads(result.content)
result = {"statisticProvince": result["data"]["list"][0]["statisticProvince"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取大区省份信息
result = json.loads(result.content)
result = {"statisticProvince": result["data"]["list"][0]["statisticProvince"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict13", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict13", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,38 +28,39 @@ request_body = commonFuc().get_business_data(module, "payload15")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取省份植入信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticMonth = result["data"]["list"][pro_random]["statisticMonth"]
statisticYear = result["data"]["list"][pro_random]["statisticYear"]
if result["data"]["list"]:
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取省份植入信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticMonth = result["data"]["list"][pro_random]["statisticMonth"]
statisticYear = result["data"]["list"][pro_random]["statisticYear"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url16")
request_body = commonFuc().get_business_data(module, "payload16", statisticProvince, statisticMonth, statisticYear)
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url16")
request_body = commonFuc().get_business_data(module, "payload16", statisticProvince, statisticMonth, statisticYear)
"""
场景: 列表查询条件验证_省份植入指标信息列表
用例名称:列表查询条件验证_省份植入指标信息列表
输出:{"statisticProvince":"%s"}
"""
"""
场景: 列表查询条件验证_省份植入指标信息列表
用例名称:列表查询条件验证_省份植入指标信息列表
输出:{"statisticProvince":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取省份植入信息
result = json.loads(result.content)
result = {"statisticProvince": result["data"]["list"][0]["statisticProvince"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取省份植入信息
result = json.loads(result.content)
result = {"statisticProvince": result["data"]["list"][0]["statisticProvince"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict16", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict16", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,39 +28,40 @@ request_body = commonFuc().get_business_data(module, "payload26")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利信息
goodsInfo = (
result["data"]["list"][good_random]["customerCode"] if result["data"]["list"][good_random]["customerCode"] else "")
statisticQuarter = result["data"]["list"][good_random]["statisticQuarter"]
statisticYear = result["data"]["list"][good_random]["statisticYear"]
if result["data"]["list"]:
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利信息
goodsInfo = (
result["data"]["list"][good_random]["customerCode"] if result["data"]["list"][good_random]["customerCode"] else "")
statisticQuarter = result["data"]["list"][good_random]["statisticQuarter"]
statisticYear = result["data"]["list"][good_random]["statisticYear"]
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url27")
request_body = commonFuc().get_business_data(module, "payload27", goodsInfo, statisticQuarter, statisticYear)
"""
场景: 列表查询条件验证_返利信息列表
用例名称:列表查询条件验证_返利信息列表
输出:{"statisticQuarter":"%s"}
"""
# 第三步进行列表条件查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url27")
request_body = commonFuc().get_business_data(module, "payload27", goodsInfo, statisticQuarter, statisticYear)
"""
场景: 列表查询条件验证_返利信息列表
用例名称:列表查询条件验证_返利信息列表
输出:{"statisticQuarter":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取返利信息
result = json.loads(result.content)
result = {"statisticQuarter": result["data"]["list"][0]["statisticQuarter"]}
# print(result)
# 获取返利信息
result = json.loads(result.content)
result = {"statisticQuarter": result["data"]["list"][0]["statisticQuarter"]}
# print(result)
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict27", statisticQuarter)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict27", statisticQuarter)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -30,44 +30,45 @@ request_body = commonFuc().get_business_data(module, "payload7")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院信息
hospInfo = result["data"]["list"][hosp_random]["hospCode"]
if result["data"]["list"]:
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院信息
hospInfo = result["data"]["list"][hosp_random]["hospCode"]
# 第三步进行信息导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url11")
request_body = commonFuc().get_business_data(module, "payload11", hospInfo)
# 第三步进行信息导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url11")
request_body = commonFuc().get_business_data(module, "payload11", hospInfo)
"""
场景: 批量导出功能验证_医院列表
用例名称:批量导出功能验证_医院列表
输出:{"hospInfo":"%s"}
"""
"""
场景: 批量导出功能验证_医院列表
用例名称:批量导出功能验证_医院列表
输出:{"hospInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/医院明细.xlsx"
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/医院明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中医院信息
excel = HandleExcel(file_path, "Sheet1")
result = {"hospInfo": excel.read_data()[0].get("医院编号")}
# 获取导出文件中医院信息
excel = HandleExcel(file_path, "Sheet1")
result = {"hospInfo": excel.read_data()[0].get("医院编号")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict11", hospInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict11", hospInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -30,45 +30,46 @@ request_body = commonFuc().get_business_data(module, "payload1")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
if result["data"]["list"]:
# 生成随机数
hosp_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取医院植入上报信息
invoiceCode = result["data"]["list"][hosp_random]["invoiceCode"]
# 获取医院植入上报信息
invoiceCode = result["data"]["list"][hosp_random]["invoiceCode"]
# 第三步进行数据导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
request_body = commonFuc().get_business_data(module, "payload3", invoiceCode)
# print(request_body)
"""
场景: 批量导出功能验证_医院植入上报列表
用例名称:批量导出功能验证_医院植入上报列表
输出:{"invoiceCode":"%s"}
"""
# 第三步进行数据导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
request_body = commonFuc().get_business_data(module, "payload3", invoiceCode)
# print(request_body)
"""
场景: 批量导出功能验证_医院植入上报列表
用例名称:批量导出功能验证_医院植入上报列表
输出:{"invoiceCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/医院植入明细.xlsx"
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/医院植入明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中医院植入上报信息
excel = HandleExcel(file_path, "Sheet1")
result = {"invoiceCode": excel.read_data()[0].get("发票号码")}
# 获取导出文件中医院植入上报信息
excel = HandleExcel(file_path, "Sheet1")
result = {"invoiceCode": excel.read_data()[0].get("发票号码")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3", invoiceCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3", invoiceCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -30,45 +30,46 @@ request_body = commonFuc().get_business_data(module, "payload23")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
date_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取发票截至日期信息
statisticMonth = result["data"]["list"][date_random]["statisticMonth"]
statisticYear = result["data"]["list"][date_random]["statisticYear"]
if result["data"]["list"]:
# 生成随机数
date_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取发票截至日期信息
statisticMonth = result["data"]["list"][date_random]["statisticMonth"]
statisticYear = result["data"]["list"][date_random]["statisticYear"]
# 第三步进行信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url25")
request_body = commonFuc().get_business_data(module, "payload25", statisticMonth, statisticYear)
"""
场景: 批量导出功能验证_发票截至日期信息列表
用例名称:批量导出功能验证_发票截至日期信息列表
输出:{"statisticYear":"%s"}
"""
# 第三步进行信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url25")
request_body = commonFuc().get_business_data(module, "payload25", statisticMonth, statisticYear)
"""
场景: 批量导出功能验证_发票截至日期信息列表
用例名称:批量导出功能验证_发票截至日期信息列表
输出:{"statisticYear":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/发票截止日明细.xlsx"
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/发票截止日明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中发票截止日信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticYear": excel.read_data()[0].get("所属年度")}
# 获取导出文件中发票截止日信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticYear": excel.read_data()[0].get("所属年度")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict25", statisticYear)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict25", statisticYear)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -31,46 +31,47 @@ request_body = commonFuc().get_business_data(module, "payload20")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
goodsInfo = result["data"]["list"][good_random]["productCode"]
productLineName = result["data"]["list"][good_random]["productLineName"]
keynoteSpec = result["data"]["list"][good_random]["keynoteSpec"]
# 第三步进行商品信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url22")
request_body = commonFuc().get_business_data(module, "payload22", goodsInfo, productLineName, keynoteSpec)
"""
场景: 批量导出功能验证_商品信息列表
用例名称:批量导出功能验证_商品信息列表
输出:{"goodsInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/商品明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中商品信息
excel = HandleExcel(file_path, "Sheet1")
result = {"goodsInfo": excel.read_data()[0].get("商品编码")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22", goodsInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["data"]["list"]:
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
goodsInfo = result["data"]["list"][good_random]["productCode"]
productLineName = result["data"]["list"][good_random]["productLineName"]
keynoteSpec = result["data"]["list"][good_random]["keynoteSpec"]
# 第三步进行商品信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url22")
request_body = commonFuc().get_business_data(module, "payload22", goodsInfo, productLineName, keynoteSpec)
"""
场景: 批量导出功能验证_商品信息列表
用例名称:批量导出功能验证_商品信息列表
输出:{"goodsInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/商品明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中商品信息
excel = HandleExcel(file_path, "Sheet1")
result = {"goodsInfo": excel.read_data()[0].get("商品编码")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22", goodsInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -30,46 +30,47 @@ request_body = commonFuc().get_business_data(module, "payload12")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取大区省份信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticRegion = result["data"]["list"][pro_random]["statisticRegion"]
if result["data"]["list"]:
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取大区省份信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticRegion = result["data"]["list"][pro_random]["statisticRegion"]
# 第三步进行列表信息导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14")
request_body = commonFuc().get_business_data(module, "payload14", statisticProvince, statisticRegion)
# print(request_body)
"""
场景: 批量导出功能验证_大区省份列表
用例名称:批量导出功能验证_大区省份列表
输出:{"statisticProvince":"%s"}
"""
# 第三步进行列表信息导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14")
request_body = commonFuc().get_business_data(module, "payload14", statisticProvince, statisticRegion)
# print(request_body)
"""
场景: 批量导出功能验证_大区省份列表
用例名称:批量导出功能验证_大区省份列表
输出:{"statisticProvince":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/大区省份明细.xlsx"
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/大区省份明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中大区省份信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticProvince": excel.read_data()[0].get("省份")}
# 获取导出文件中大区省份信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticProvince": excel.read_data()[0].get("省份")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict14", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict14", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -31,46 +31,47 @@ request_body = commonFuc().get_business_data(module, "payload15")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取省份植入信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticMonth = result["data"]["list"][pro_random]["statisticMonth"]
statisticYear = result["data"]["list"][pro_random]["statisticYear"]
# 第三步进行信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url17")
request_body = commonFuc().get_business_data(module, "payload17", statisticProvince, statisticMonth, statisticYear)
"""
场景: 批量导出功能验证_省份植入指标信息列表
用例名称:批量导出功能验证_省份植入指标信息列表
输出:{"statisticProvince":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/省份植入指标明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中身份植入指标信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticProvince": excel.read_data()[0].get("省份")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["data"]["list"]:
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取省份植入信息
statisticProvince = result["data"]["list"][pro_random]["statisticProvince"]
statisticMonth = result["data"]["list"][pro_random]["statisticMonth"]
statisticYear = result["data"]["list"][pro_random]["statisticYear"]
# 第三步进行信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url17")
request_body = commonFuc().get_business_data(module, "payload17", statisticProvince, statisticMonth, statisticYear)
"""
场景: 批量导出功能验证_省份植入指标信息列表
用例名称:批量导出功能验证_省份植入指标信息列表
输出:{"statisticProvince":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/省份植入指标明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中身份植入指标信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticProvince": excel.read_data()[0].get("省份")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17", statisticProvince)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -30,46 +30,47 @@ request_body = commonFuc().get_business_data(module, "payload26")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利信息
goodsInfo = (
result["data"]["list"][good_random]["customerCode"] if result["data"]["list"][good_random]["customerCode"] else "")
statisticQuarter = result["data"]["list"][good_random]["statisticQuarter"]
statisticYear = result["data"]["list"][good_random]["statisticYear"]
if result["data"]["list"]:
# 生成随机数
good_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利信息
goodsInfo = (
result["data"]["list"][good_random]["customerCode"] if result["data"]["list"][good_random]["customerCode"] else "")
statisticQuarter = result["data"]["list"][good_random]["statisticQuarter"]
statisticYear = result["data"]["list"][good_random]["statisticYear"]
# 第三步返利信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url28")
request_body = commonFuc().get_business_data(module, "payload28", goodsInfo, statisticQuarter, statisticYear)
"""
场景: 批量导出功能验证_返利信息列表
用例名称:批量导出功能验证_返利信息列表
输出:{"statisticQuarter":"%s"}
"""
# 第三步返利信息批量导出
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url28")
request_body = commonFuc().get_business_data(module, "payload28", goodsInfo, statisticQuarter, statisticYear)
"""
场景: 批量导出功能验证_返利信息列表
用例名称:批量导出功能验证_返利信息列表
输出:{"statisticQuarter":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/返利明细.xlsx"
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/返利明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取导出文件中身份植入指标信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticQuarter": excel.read_data()[0].get("季度")}
# 获取导出文件中身份植入指标信息
excel = HandleExcel(file_path, "Sheet1")
result = {"statisticQuarter": excel.read_data()[0].get("季度")}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict28", statisticQuarter)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict28", statisticQuarter)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment