예제 #1
0
def search_late_report_no():
    """
    t_result_001_scene_case_report 业务场景用例执行结果表,获取最新的报告号
    :return:
    """
    sql = 'select distinct report_no from t_result_001_scene_case_report order by report_no desc limit 1;'
    return DBUtils().search(sql, [])
예제 #2
0
def get_lc_business_result_head():
    """
    t_result_001_scene_case_report 业务场景用例执行结果表,获取表头(多级表头)
    """
    # 数据库添加记录
    sql = 'select column_comment, column_name from information_schema.columns where table_name="t_result_001_scene_case_report";'
    return DBUtils().search(sql, [])
예제 #3
0
def search_intf_addr():
    """
    t_config_001_intf_address接口地址映射表,记录查询
    :return: 查询结果
    """
    sql = 'select intf_code, intf_addr from t_config_001_intf_address'

    return DBUtils().search(sql, [])
예제 #4
0
def search_fail_test_scene(report_no):
    """
    t_result_001_scene_case_report 业务场景用例执行结果表,根据传入的报告号,获取执行失败的场景
    :return:
    """
    sql = 'select distinct scene_name from t_result_001_scene_case_report where report_no=%s and assert="False";'
    return DBUtils().search(sql, [
        report_no,
    ])
예제 #5
0
def search_lc_business_result(report_no):
    """
    t_result_001_scene_case_report 业务场景用例执行结果表,根据报告号查询结果
    :param report_no:
    :return:
    """
    # 数据库添加记录
    sql = 'select * from t_result_001_scene_case_report where report_no = %s order by id;'
    if isinstance(report_no, list):
        return DBUtils().search(sql, report_no)
    else:
        print('查询数据库,传入参数不满足要求。')
예제 #6
0
def add_lc_business_result(value_list):
    """
    t_result_001_scene_case_report 业务场景用例执行结果表,插入数据
    :param value_list:
    :return:
    """
    # 数据库添加记录
    sql = 'insert into t_result_001_scene_case_report(id, create_time, report_no, scene_name, step, request_url, request_body, respond_body, assert, remark) values (null, now(), %s, %s, %s, %s, %s, %s, %s, %s);'
    if isinstance(value_list, list) and len(value_list) == 15:
        DBUtils().add(sql, value_list)
    else:
        print('插入数据库,传入参数不满足要求。')
예제 #7
0
def func_handle(param):
    """
    多线程处理函数
    :param report_no: 报告号
    :param num: 序号
    :param url: 请求地址
    :param req_body: 请求体
    """
    report_no, num, url, req_body = param
    request_type = 'post'
    headers = {"Content-Type": "text/plain; charset=UTF-8"}
    data_type = 'xml'
    # 1. 请求
    respond = RequestBase(request_type, url, req_body,
                          headers).get_respond_body()
    # 2.获取各字段值

    # 3.数据库添加记录
    sql = 'insert into t_result_001_scene_case_report(id, create_time, report_no, step, request_url, request_body, respond_body, remark) values (null, now(), %s, %s, %s, %s, %s, %s);'
    # 备注信息(手工调整)
    remark = ''
    value_list = [report_no, num, url, req_body, respond, remark]

    DBUtils().add(sql, value_list)