コード例 #1
0
ファイル: case_false_rerun.py プロジェクト: lisalitester/UI
def rerun(self, url, func):
    circle = 3
    while circle > 0:
        if circle == 3:
            func(self)
        else:
            if url != "":
                self.driver.get(url)
                time.sleep(1)
            func(self)
        info_data = readInfo(PATH("../log/" + ElementParam.INFO_FILE))
        if info_data[-1]['case_name'] == func.__name__ and info_data[-1][
                'result'] == '失败' and circle > 1:
            if os.path.exists(info_data[-1]['img']):
                os.remove(info_data[-1]['img'])
                print('删除错误截图')
            else:
                print('图片路径不存在')
            info_data.pop(-1)
            write(info_data, PATH("../log/" + ElementParam.INFO_FILE))
            count_sum_false_cancel(
                PATH("../log/" + ElementParam.SUM_FILE))  # 统计 总数减1 失败数减1
            self.logTest.checkPoint_false_cancel()  # checkPoint_减1
        elif info_data[-1]['case_name'] == func.__name__ and info_data[-1][
                'result'] == '通过':
            break
        circle -= 1
コード例 #2
0
def countDate(testDate, testSumDate):
    data = read(PATH("../log/" + ElementParam.SUM_FILE))
    if data:
        data["testDate"] = testDate
        data["testSumDate"] = testSumDate
        write(data=data, path=PATH("../log/" + ElementParam.SUM_FILE))
    else:
        print("统计数据失败")
    data = read(PATH("../log/" + ElementParam.SUM_FILE))
    print("==统计数据:%s==" % data)
コード例 #3
0
def count_sum(result):
    data = {"sum": 0, "pass": 0, "fail": 0}
    _read = read("../log/" + ElementParam.SUM_FILE)
    if _read:
        data = _read
    data["sum"] += 1
    if result:
        data["pass"] += 1
    else:
        data["fail"] += 1
    write(data=data, path="../log/" + ElementParam.SUM_FILE)
コード例 #4
0
ファイル: TearDown.py プロジェクト: lisalitester/UI
def mk_file():
    '''
    1.删除 info.pickle文件 和 sum.pickle文件
    2. 创建info.pickle文件 和 sum.pickle文件
    3. 把data 写入sum.pickle文件
    '''
    destroy()
    mkdir_file(PATH("../log/" + ElementParam.INFO_FILE))
    mkdir_file(PATH("../log/" + ElementParam.SUM_FILE))

    data = read(PATH("../log/" + ElementParam.INFO_FILE))

    data["version"] = ElementParam.VERSION
    data["sum"] = 0
    data["pass"] = 0
    data["fail"] = 0
    write(data=data, path=PATH("../log/" + ElementParam.SUM_FILE))
コード例 #5
0
def count_sum_false_cancel(result):
    # 失败后重跑 sum 减 1
    data = read("../log/" + ElementParam.SUM_FILE)
    data["sum"] -= 1
    data["fail"] -= 1
    write(data=data, path="../log/" + ElementParam.SUM_FILE)