Exemplo n.º 1
0
def runTestSuite(args):
    try:
        opts = args.get('opts', {})
        testsuite = args['testsuite']
    except KeyError:
        return common_utils.error_handler('Lack of testsuite argument')

    if 'suite' not in opts:
        opts['suite'] = 'true'

    testsuite = os.path.join(consts.TESTSUITE_DIR, '{}.yaml'.format(testsuite))

    task_id = str(uuid.uuid4())

    command_list = ['task', 'start']
    command_list = common_utils.get_command_list(command_list, opts, testsuite)
    logger.debug('The command_list is: %s', command_list)

    logger.debug('Start to execute command list')
    task_dic = {
        'task_id': task_id,
        'details': _get_cases_from_suite_file(testsuite)
    }
    common_utils.exec_command_task(command_list, task_dic)

    return common_utils.result_handler('success', task_id)
Exemplo n.º 2
0
    def test_get_command_list_no_opts(self):
        command_list = ['a']
        opts = {}
        args = 'b'
        output_list = common.get_command_list(command_list, opts, args)

        result_list = ['a', 'b']
        self.assertEqual(result_list, output_list)
Exemplo n.º 3
0
    def test_get_command_list_with_opts_args(self):
        command_list = ['a']
        opts = {'b': 'c', 'task-args': 'd'}
        args = 'e'

        output_list = common.get_command_list(command_list, opts, args)

        result_list = ['a', 'e', '--b', '--task-args', 'd']
        self.assertEqual(result_list, output_list)
Exemplo n.º 4
0
def runTestCase(args):
    try:
        opts = args.get('opts', {})
        testcase = args['testcase']
    except KeyError:
        return common_utils.error_handler('Lack of testcase argument')

    testcase_name = conf.TEST_CASE_PRE + testcase
    testcase = os.path.join(conf.TEST_CASE_PATH, testcase_name + '.yaml')

    task_id = str(uuid.uuid4())

    command_list = ['task', 'start']
    command_list = common_utils.get_command_list(command_list, opts, testcase)
    logger.debug('The command_list is: %s', command_list)

    logger.debug('Start to execute command list')
    task_dict = {'task_id': task_id, 'details': testcase_name}
    common_utils.exec_command_task(command_list, task_dict)

    return common_utils.result_handler('success', task_id)
Exemplo n.º 5
0
def runTestSuite(args):
    try:
        opts = args.get('opts', {})
        testsuite = args['testsuite']
    except KeyError:
        return common_utils.error_handler('Lack of testsuite argument')

    if 'suite' not in opts:
        opts['suite'] = 'true'

    testsuite = os.path.join(conf.TEST_SUITE_PATH,
                             conf.TEST_SUITE_PRE + testsuite + '.yaml')

    task_id = str(uuid.uuid4())

    command_list = ['task', 'start']
    command_list = common_utils.get_command_list(command_list, opts, testsuite)
    logger.debug('The command_list is: %s', command_list)

    logger.debug('Start to execute command list')
    common_utils.exec_command_task(command_list, task_id)

    return common_utils.result_handler('success', task_id)