class RunMain:
def run_case(self):
rows = excel_data.get_row()
for i in range(rows):
data = excel_data.get_row_value(i+2)
is_run = data[2]
if is_run == ‘yes’:
url = data[5]
excepect_method = data[11]
excepect_result = data[12]
head = data[8]
if head == ‘yes’:
head = get_header()
method = data[6]
is_depend = data[3]
data = json.loads(data[7])
if is_depend:
is_depend_key = data[4]
depend_data = get_data(is_depend)
data[depend_data] = depend_data
res = request.run_main(method=method,url=url,data=data,header=head)
print(res)
code = res[‘state’]
message = res[‘success’]
message = str(message)
code = res[‘state’]
message = res[‘success’]
message = str(message)
if excepect_method == “mec”:
config_message = handle_result(url, “state”)
config_message1 = handle_result(url, “success”)
if code == config_message and message == config_message1:
excel_data.excel_write_data(i + 2, 14, “通过”)
else:
excel_data.excel_write_data(i + 2, 14, “失败”)
excel_data.excel_write_data(i + 2, 15, json.dumps(res))
if excepect_method == "errorcode":
if code == excepect_result:
excel_data.excel_write_data(i + 2, 14, "通过")
else:
excel_data.excel_write_data(i + 2, 14, "失败")
excel_data.excel_write_data(i + 2, 15, json.dumps(res))
if excepect_method == "json":
if code == "1":
get_result = get_result_json(url, "data")
reslut = handle_result_json(res["data"], get_result)
if reslut == True:
excel_data.excel_write_data(i + 2, 14, "通过")
else:
excel_data.excel_write_data(i + 2, 14, "失败")
excel_data.excel_write_data(i + 2, 15, json.dumps(res))