首页 > 其他 > 详细

get_data.py

时间:2020-09-26 18:34:23      阅读:49      评论:0      收藏:0      [点我收藏+]
#coding:utf-8
from base.operation_excel import OperationExcel
from base.operation_json import OperetionJson
class global_var:
#case_id
Id = ‘0‘
#测试用例名称
request_name = ‘1‘
#接口测试url
url = ‘2‘
#执行结果
result = ‘5‘
#是否执行
run = ‘3‘
#测试数据的json文件
data = ‘4‘

class GetData:
def __init__(self):
self.opera_excel = OperationExcel()


#获取caseid判断是否执行
def get_is_run(self,case_id):
flag = None
col = int(global_var.run)
row = OperationExcel().get_row_num(case_id)
run_model = self.opera_excel.get_cell_value(row,col)
if run_model == ‘yes‘:
flag = True
else:
flag = False
return flag




#获取url
def get_request_url(self,row):
col = int(global_var.url)
url = self.opera_excel.get_cell_value(row,col)
return url

#获取请求数据
def get_request_data(self,row):
col = int(global_var.data)
data = self.opera_excel.get_cell_value(row,col)
if data == ‘‘:
return None
return data

#通过获取关键字拿到data数据
def get_data_for_json(self,row):
opera_json = OperetionJson()
request_data = opera_json.get_data(self.get_request_data(row))
return request_data




#写入执行结果
def write_result(self,row,value):
col = int(global_var.result)
self.opera_excel.write_value(row,col,value)








if __name__ == ‘__main__‘:
t=GetData()
t.write_result(1,‘pass‘)

get_data.py

原文:https://www.cnblogs.com/macrolai/p/13735496.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!