Ejemplo n.º 1
0
 def test_refund(self, caseid, desc, precondition, parameterize, url,
                 method, header, data, shared, check):
     log.info("CaseId: <- {} ->".format(caseid))
     log.info("Desc: {}".format(desc))
     header = cotool().set_header(header)
     params = cotool().set_params(parameterize, data)
     res = httprequest(url, method, header, params)
     if shared:
         cotool.extract_variable(res, shared)
     cotool().assert_res(res, check)
     allure.dynamic.story("CaseID: < {} > - {}".format(caseid, desc))
Ejemplo n.º 2
0
 def test_mainlink(self, caseid, desc, precondition, parameterize, url,
                   method, header, data, shared, check):
     log.info("CaseId: <- {} ->".format(caseid))
     log.info("Desc: {}".format(desc))
     if str(caseid) == "10022":
         time.sleep(30)
     header = cotool().set_header(header)
     params = cotool().set_params(parameterize, data)
     res = httprequest(url, method, header, params)
     if shared:
         cotool.extract_variable(res, shared)
     if check:
         cotool().assert_res(res, check)
     if str(caseid) == "10017":
         tools.create_qr_code(GLOBAL_VAR["creativityCode"])
         time.sleep(180)
     allure.dynamic.story("CaseID: < {} > - {}".format(caseid, desc))
Ejemplo n.º 3
0
 def test_democase(self, caseid, desc, precondition, parameterize, url,
                   method, header, data, shared, check):
     # 打印日志信息
     log.info("CaseId: <- {} ->".format(caseid))
     log.info("Desc: {}".format(desc))
     # 判断是否需要前置运行所需接口
     if precondition:
         print("我需要前置条件")
     # 处理header
     header = cotool().set_header(header)
     # 处理params中的参数
     params = cotool().set_params(parameterize, data)
     res = httprequest(url, method, header, params)
     # 对res进行提取变量处理
     if shared:
         cotool.extract_variable(res, shared)
     # 断言code及msg,后期取断言data中的字段是否存在于res中
     cotool().assert_res(res, check)
     # allure记录信息
     allure.dynamic.story("CaseID: < {} > - {}".format(caseid, desc))