Example #1
0
def build_data(tag):
    """

    :param tag:
    :return:
    """
    data_list_success = []
    data_list_fail = []
    data = GetData().get_yml_data('login.yml')
    for key in data:
        # 'success':  case_num, name, pwd, exp_data:
        case_num = key
        name = data.get(key).get('username')
        pwd = data.get(key).get('passwd')
        toast = data.get(key).get('toast')
        exp_data = data.get(key).get('exp_data')
        if tag == 'success' and not toast:  # 正向用例
            data_list_success.append((case_num, name, pwd, exp_data))
        elif tag == 'fail' and toast:
            data_list_fail.append((case_num, name, pwd, toast, exp_data))
    # print("data_list_success: ",data_list_success)
    # print("data_list_fail: ", data_list_fail)
    if tag == 'success':  # 正向用例
        return data_list_success
    else:
        return data_list_fail
Example #2
0
def date():
    # 成功数据列表
    suc_list = []
    # 失败数据列表
    fail_list = []
    # 实例化数据读取文件
    value = GetData().get_yml_data("login_data.yml")
    for i in value.keys():
        if value.get(i).get("toast"):
            fail_list.append((i, value.get(i).get("user"), value.get(i).get("pwd"),
                              value.get(i).get("toast"), value.get(i).get("excep")))
        else:
            suc_list.append((i, value.get(i).get("user"), value.get(i).get("pwd"),
                             value.get(i).get("excep")))
    return {"suc": suc_list, "fail": fail_list}
Example #3
0
def get_login_data():
    # [()] 成功数据列表
    suc_list = []  # [(用例编号, 用户名, 密码, 预期结果)]
    # [()]
    fail_list = []  # [(用例编号, 用户名, 密码, toast获取消息, 预期结果)]
    # 读文件数据
    data = GetData().get_read_yml("login_data.yml").get("Login_data")
    for i in data.keys():
        if data.get(i).get("toast_mes"):
            # 预期失败用例添加
            fail_list.append(
                (i, data.get(i).get("username"), data.get(i).get("passwd"),
                 data.get(i).get("toast_mes"), data.get(i).get("exp_data")))
        else:
            # 预期成功用例添加
            suc_list.append(
                (i, data.get(i).get("username"), data.get(i).get("passwd"),
                 data.get(i).get("exp_data")))
    return {"suc": suc_list, "fail": fail_list}