def __init__(self,
              txt_path=None,
              report_path=None,
              excelpath=None,
              jsonpath=None):
     if report_path:
         self.report_path = report_path
     else:
         self.report_path = "../Test_Case/Report.html"
     if txt_path:
         self.txt_path = txt_path
     else:
         self.txt_path = "../Test_Case/Result.txt"
     if jsonpath:
         self.jsonpath = jsonpath
     else:
         self.jsonpath = "../Test_Case/TestCase.xls"
     self.run_method = inter()
     self.data = Getdata(excelpath=excelpath, jsonfilepath=jsonpath)
     self.result = isequal()
     self.opexcel = oper_excel(filename=excelpath)
     self.sendmail = sendmail()
     self.page_check = PageCheck()
     self.de_data = dependata(excelpath=excelpath, jsonpath=jsonpath)
     self.pass_total = []
     self.fail_total = []
 def __init__(self,excelpath= None,jsonpath=None):
     if excelpath:
         self.excelpath = excelpath
     else:
         self.excelpath = '../Test_Case/TestCase.xls'
     if jsonpath:
         self.jsonpath = jsonpath
     else:
         self.jsonpath='..//data//Tc_alldata.json'
     self.get = Getdata(self.excelpath,self.jsonpath)
     self.operation_excel = oper_excel(self.excelpath)
 def save_json(self, rejson):
     result = rejson["Data"][0]
     excel = oper_excel(filename=self.depen_path)
     i = len(result)
     j = 0
     key = []
     value = []
     for k in result:
         key.append(k)
         value.append(result[k])
     for i in range(len(key)):
         excel.write_value(i, 0, key[i])
         excel.write_value(i, 1, value[i])
示例#4
0
 def send_get(self, url, params, cookies=None, return_value=None):
     # if header != None:
     # print("---",params,type(params))
     res = requests.get(url=url,
                        params=params,
                        cookies=cookies,
                        verify=False,
                        allow_redirects=False)
     # else:
     #     res = requests.get(url=url, params=params, verify=False,allow_redirects=False)
     if str(res.status_code).startswith('2'):
         # 201、202等,请求连接成功
         print('接口连接状态', res.status_code, '接口状态正常')
         if return_value.startswith("y") or return_value.startswith("Y"):
             # 获取返回的data数据
             try:
                 result = res.json()["Data"][0]
                 excel = oper_excel(
                     filename="../global_var/depend_data.xls")
                 i = len(result)
                 j = 0
                 key = []
                 value = []
                 for k in result:
                     key.append(k)
                     value.append(result[k])
                 for i in range(len(key)):
                     excel.write_value(i, 0, key[i])
                     if type(value[i]) == dict:
                         excel.write_value(i, 1, str(value[i]))
                     else:
                         excel.write_value(i, 1, value[i])
             except Exception as e:
                 print(e)
         # print("返回",res,res.url)
         return res, res.url
     elif str(res.status_code).startswith('3'):
         # 301、302等,重定向
         # response的header中获取重定向指向地址-location
         direct_url = res.headers["Location"]
         print("数据重定向指向该网址", direct_url)
         print('接口连接状态', res.status_code)
         return res, direct_url
     else:
         print('接口连接状态', res.status_code, ',接口状态异常')
示例#5
0
 def __init__(self, excelpath=None, jsonpath=None):
     self.tablename = Case_Table().get_tablename()
     if excelpath:
         self.excelpath = excelpath
     else:
         self.excelpath = "../Test_Case/" + self.tablename + ".xls"
     if jsonpath:
         self.jsonpath = jsonpath
     else:
         self.jsonpath = "../data/" + self.tablename + ".json"
     self.run_method = inter()
     self.data = Getdata(self.excelpath, self.jsonpath)
     self.result = isequal()
     self.sendmail = sendmail()
     self.page_check = PageCheck()
     self.de_data = dependata(self.excelpath, self.jsonpath)
     self.caserun = Case(excelpath=self.excelpath, jsonpath=self.jsonpath)
     self.opexcel = oper_excel(filename=excelpath)
     self.DBCASE = Get_case()
示例#6
0
 def __init__(self):
     self.excelpath= "../Test_Case/Paper_Process.xls"
     self.db,self.connect  = DB_CONNECT(2).connect_db()
     self.excel = oper_excel(filename="../Test_Case/Paper_Process.xls")
     self.data = Getdata(excelpath=self.excelpath)
示例#7
0
 def __init__(self, excelpath, file_path):
     self.data = Getdata(excelpath=excelpath)
     self.opexcel = oper_excel(filename=excelpath)
     self.file_path = file_path