Commit e3b8860f by jiaqiying
parents 76359dc0 ef5c5454
from common.tools import request_main
__author__ = 'dengmaosheng' __author__ = 'dengmaosheng'
__data__ = "2021-05-08 10:26" __data__ = "2021-05-08 10:26"
import pytest import pytest
...@@ -19,6 +21,9 @@ def bmc_login_fixture(): ...@@ -19,6 +21,9 @@ def bmc_login_fixture():
# BMCConfig.headers['Pvt-Token'] = res[1] # BMCConfig.headers['Pvt-Token'] = res[1]
# BMCConfig.headers['Token'] = res[0] # BMCConfig.headers['Token'] = res[0]
if __name__ == '__main__': if __name__ == '__main__':
bmc_login_fixture() bmc_login_fixture()
......
...@@ -36,15 +36,17 @@ def get_vehickleId_Tounbind(): ...@@ -36,15 +36,17 @@ def get_vehickleId_Tounbind():
@allure.epic("电子证照") @allure.epic("电子证照")
# @allure.feature("电子驾驶证") # @allure.feature("电子驾驶证")
class TestDrivingLicense(): class TestDrivingLicense():
workBook = xlrd.open_workbook(f'{BaseConfig.root_path}/test_case_data/bmc/bmc_testcase01_20210513.xlsx') workBook = xlrd.open_workbook(f'{BaseConfig.root_path}/test_case_data/bmc/bmc_tk.xlsx')
@allure.story("二维码详情") @allure.story("二维码详情")
@allure.link("http://yapi.hikcreate.com/project/32/interface/api/81596") @allure.link("http://yapi.hikcreate.com/project/32/interface/api/81596")
@allure.description("/dlVeh/qr") @allure.description("/dlVeh/qr")
@allure.title("{inData[testPoint]}") @allure.title("{inData[testPoint]}")
@pytest.mark.parametrize("inData", get_excelData(workBook,'电子证照', 'dlVehqr')) @pytest.mark.parametrize("inData", get_excelData(workBook, '电子证照', 'dlVehqr'))
def test_dlVehQr(self,inData): def test_dlVehQr(self,inData):
url = f"{BMCConfig().pvthost}{inData['url']}" url = f"{BMCConfig().pvthost}{inData['url']}"
method = inData['method'] method = inData['method']
...@@ -72,6 +74,7 @@ class TestDrivingLicense(): ...@@ -72,6 +74,7 @@ class TestDrivingLicense():
"""断言""" """断言"""
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("照片审核状态") @allure.story("照片审核状态")
@allure.link("http://yapi.hikcreate.com/project/32/interface/api/22759") @allure.link("http://yapi.hikcreate.com/project/32/interface/api/22759")
@allure.description("/drivingLicense/image/audit/status") @allure.description("/drivingLicense/image/audit/status")
...@@ -104,6 +107,7 @@ class TestDrivingLicense(): ...@@ -104,6 +107,7 @@ class TestDrivingLicense():
"""断言""" """断言"""
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@pytest.mark.scoreDetail
@allure.story("修改驾驶证头像") @allure.story("修改驾驶证头像")
@allure.link("http://yapi.hikcreate.com/project/32/interface/api/22750") @allure.link("http://yapi.hikcreate.com/project/32/interface/api/22750")
@allure.description("/drivingLicense/avatar/update") @allure.description("/drivingLicense/avatar/update")
...@@ -120,7 +124,7 @@ class TestDrivingLicense(): ...@@ -120,7 +124,7 @@ class TestDrivingLicense():
"""断言""" """断言"""
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
# @pytest.mark.scoreDetail
@allure.story("驾照扣分记录") @allure.story("驾照扣分记录")
@allure.link("http://yapi.hikcreate.com/project/32/interface/api/5332") @allure.link("http://yapi.hikcreate.com/project/32/interface/api/5332")
@allure.description("/drivingLicense/score/detail") @allure.description("/drivingLicense/score/detail")
...@@ -154,8 +158,6 @@ class TestDrivingLicense(): ...@@ -154,8 +158,6 @@ class TestDrivingLicense():
# assert res['code'] == expectData['code'] # assert res['code'] == expectData['code']
# @pytest.fixture(scope='function') # 用例中不能这么写
# @pytest.mark.usefixtures('test_vehicleLicenseList')
@allure.story("我的行驶证列表") @allure.story("我的行驶证列表")
@allure.link("http://yapi.hikcreate.com/project/32/interface/api/46536") @allure.link("http://yapi.hikcreate.com/project/32/interface/api/46536")
@allure.description("/vehicle/license/list") @allure.description("/vehicle/license/list")
...@@ -373,7 +375,7 @@ if __name__ == '__main__': ...@@ -373,7 +375,7 @@ if __name__ == '__main__':
for one in os.listdir('../../report/tmp'): # 列出对应文件夹的数据 '-m','scoreDetail' , for one in os.listdir('../../report/tmp'): # 列出对应文件夹的数据 '-m','scoreDetail' ,
if 'json' in one: if 'json' in one:
os.remove(f'../../report/tmp/{one}') os.remove(f'../../report/tmp/{one}')
pytest.main(['test_ ElectronicLicense.py', '-s', '--alluredir','../../report/tmp']) pytest.main(['test_ ElectronicLicense.py', '-s', '--alluredir','../../report/tmp'])
# 启动默认浏览器打开报告 # 启动默认浏览器打开报告
os.system('allure serve ../../report/tmp') os.system('allure serve ../../report/tmp')
......
...@@ -12,7 +12,7 @@ from config import BMCConfig ...@@ -12,7 +12,7 @@ from config import BMCConfig
# @allure.feature("信用分") # @allure.feature("信用分")
class TestCreditScore(): class TestCreditScore():
workBook = xlrd.open_workbook(f'{BMCConfig.root_path}/test_case_data/bmc/bmc_testcase01_20210513.xlsx') # workBook = xlrd.open_workbook(f'{BMCConfig.root_path}/test_case_data/bmc/bmc_credit_score_20210513.xlsx')
# inData = get_excelData(workBook, '信用分', 'creditscore')[0] # inData = get_excelData(workBook, '信用分', 'creditscore')[0]
def bmc_login_fixture(self): def bmc_login_fixture(self):
...@@ -21,10 +21,10 @@ class TestCreditScore(): ...@@ -21,10 +21,10 @@ class TestCreditScore():
indata = {"phone": "17822000000", indata = {"phone": "17822000000",
"encodedGesture": "67e6d10010533eed4bbe9659863bf6ee"} "encodedGesture": "67e6d10010533eed4bbe9659863bf6ee"}
res = BMC().bmc_login(indata) res = BMC().bmc_login(indata)
# setattr(BMCConfig, 'bmc_token', res[0]) setattr(BMCConfig, 'bmc_token', res[0])
# setattr(BMCConfig, 'bmc_pvt_token', res[1]) setattr(BMCConfig, 'bmc_pvt_token', res[1])
BMCConfig.headers['Pvt-Token'] = res[1] # BMCConfig.headers['Pvt-Token'] = res[1]
BMCConfig.headers['Token'] = res[0] # BMCConfig.headers['Token'] = res[0]
# #
# # print('Pvt-Token==========================', res[1]) # # print('Pvt-Token==========================', res[1])
# # print('Token==========================', res[0]) # # print('Token==========================', res[0])
...@@ -43,7 +43,7 @@ class TestCreditScore(): ...@@ -43,7 +43,7 @@ class TestCreditScore():
# print(expectData) # print(expectData)
#res = requests.post(url = url,headers =headers,json =req_data ) #res = requests.post(url = url,headers =headers,json =req_data )
res = request_main(url=url, headers=None, method=method, data=req_data, has_token=False) res = request_main(url=url, headers=None, method=method, data=req_data, has_token=False)
# print(res) print(res)
# assert res['code'] == expectData['code'] # assert res['code'] == expectData['code']
...@@ -53,11 +53,11 @@ if __name__ == '__main__': ...@@ -53,11 +53,11 @@ if __name__ == '__main__':
# r'--alluredir=D:\项目\接口自动化\InterfaceAutoTest\report', '--clean-alluredir']) # r'--alluredir=D:\项目\接口自动化\InterfaceAutoTest\report', '--clean-alluredir'])
# #
# os.system('allure serve D:\项目\接口自动化\InterfaceAutoTest\\report') # os.system('allure serve D:\项目\接口自动化\InterfaceAutoTest\\report')
workBook = xlrd.open_workbook(f'{BMCConfig.root_path}/test_case_data/bmc/bmc_testcase01_20210513.xlsx') workBook = xlrd.open_workbook(f'{BMCConfig.root_path}/test_case_data/bmc/bmc_vehicle_steward_29_39_20210513.xlsx')
inData = get_excelData(workBook, '三车违法学习', 'getPaperIllegalstudy')[0] inData = get_excelData(workBook, '出行服务', 'agreevehiclesteward')
# # print(inData) print(inData)
TestCreditScore().bmc_login_fixture() # TestCreditScore().bmc_login_fixture()
TestCreditScore().test_creditscore(inData) # TestCreditScore().test_creditscore(inData)
# res = requests.get('http://testbmcapp.hikcreate.com/credit/myCredit/V2', params={"bCityCode":"520100","bNetTag":"trf_mgt"}, # res = requests.get('http://testbmcapp.hikcreate.com/credit/myCredit/V2', params={"bCityCode":"520100","bNetTag":"trf_mgt"},
# headers= { # headers= {
......
__author__ = 'fanxun'
__data__ = "2021-05-18 14:41"
import allure, xlrd, pytest
from config import BMCConfig
from common.utils.getExcelData import get_excelData
from common.tools import request_main
@allure.feature("出行服务")
class TestCreditScore():
workBook = xlrd.open_workbook(f'{BMCConfig.root_path}/test_case_data/bmc/bmc_vehicle_steward_29_39_20210513.xlsx')
@allure.story("获取用户授权")
@allure.link("http://yapi.hikcreate.com/project/31/interface/api/75421")
@allure.description("/vehicle/steward/authorization/authorizationOfUse")
@allure.title("{inData[testPoint]}")
@pytest.mark.parametrize("inData", get_excelData(workBook, '出行服务', 'authorizationOfUsevehicle_steward'))
def test_my_integral(self,inData):
url = f"{BMCConfig().host}{inData['url']}"
method = inData['method']
req_data = inData['reqData']
expectData = inData['expectData']
headers = inData['headers']
res = request_main(url=url, headers=headers, method=method, data=req_data, has_token=False)
assert res['code'] == expectData['code']
\ 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 to comment