예제 #1
0
def group_failed(args):
    try:
        cases = json.load(
            open(
                os.path.realpath(
                    os.path.join(
                        os.path.abspath(args.output).replace('\\', '/'),
                        'test_cases.json'))))
    except Exception as e:
        core_config.logging.error("Can't load test_cases.json")
        core_config.main_logger.error(str(e))
        exit(-1)

    for case in cases:
        if case['status'] == 'active':
            case['status'] = 'skipped'

    with open(
            os.path.join(
                os.path.abspath(args.output).replace('\\', '/'),
                'test_cases.json'), 'w+') as f:
        json.dump(cases, f, indent=4)

    rc = main(args)
    kill_process(PROCESS)
    core_config.main_logger.info(
        'Finish simpleRender with code: {}'.format(rc))
    exit(rc)
예제 #2
0
def group_failed(args):
    core_config.main_logger.error('Group failed')
    status = 'skipped'
    try:
        cases = json.load(
            open(
                os.path.realpath(
                    os.path.join(os.path.abspath(args.output),
                                 'test_cases.json'))))
    except Exception as e:
        core_config.logging.error("Can't load test_cases.json")
        core_config.main_logger.error(str(e))
        cases = json.load(
            open(
                os.path.realpath(
                    os.path.join(os.path.dirname(__file__), '..', 'Tests',
                                 args.testType, 'test_cases.json'))))
        status = 'inprogress'

    for case in cases:
        if case['status'] == 'active':
            case['status'] = status

    with open(os.path.join(os.path.abspath(args.output), 'test_cases.json'),
              "w+") as f:
        json.dump(cases, f, indent=4)

    rc = main(args)
    kill_process(PROCESS)
    close_untitled_windows()
    core_config.main_logger.info(
        "Finish simpleRender with code: {}".format(rc))
    exit(rc)
예제 #3
0
                            os.path.abspath(args.output).replace('\\', '/'),
                            'test_cases.json'))))
        except Exception as e:
            core_config.logging.error("Can't load test_cases.json")
            core_config.main_logger.error(str(e))
            exit(-1)

        active_cases = 0
        failed_count = 0

        for case in cases:
            if case['status'] in ['fail', 'error', 'inprogress']:
                failed_count += 1
                if args.fail_count == failed_count:
                    group_failed(args)
            else:
                failed_count = 0

            if case['status'] in ['active', 'fail', 'inprogress']:
                active_cases += 1

        if active_cases == 0 or old_active_cases == active_cases or iteration > len(
                cases):
            # exit script if base_functions don't change number of active cases
            kill_process(PROCESS)
            core_config.main_logger.info(
                'Finish simpleRender with code: {}'.format(rc))
            exit(rc)

        old_active_cases = active_cases