def __init__(self, stream_opener, config):
        super(AllureFormatter, self).__init__(stream_opener, config)

        self.listener = AllureListener(config)
        file_logger = AllureFileLogger(self.stream_opener.name)

        allure_commons.plugin_manager.register(self.listener)
        allure_commons.plugin_manager.register(file_logger)

        self.testplan = get_testplan()
Esempio n. 2
0
def select_by_testcase(items):
    planned_tests = get_testplan()

    if planned_tests:

        def is_planed(item):
            allure_ids = allure_label(item, LabelType.ID)
            allure_string_ids = list(map(str, allure_ids))
            for planed_item in planned_tests:
                planed_item_string_id = str(planed_item.get("id"))
                planed_item_selector = planed_item.get("selector")
                if (planed_item_string_id in allure_string_ids
                        or planed_item_selector == allure_full_name(item)):
                    return True
            return False

        return [item for item in items if is_planed(item)]
    else:
        return items
Esempio n. 3
0
def select_by_testcase(items, config):
    planned_tests = get_testplan()
    is_inversion = config.option.inversion

    if planned_tests:

        def is_planed(item):
            allure_ids = allure_label(item, LabelType.ID)
            allure_string_ids = list(map(str, allure_ids))
            for planed_item in planned_tests:
                planed_item_string_id = str(planed_item.get("id"))
                planed_item_selector = planed_item.get("selector")
                if (planed_item_string_id in allure_string_ids
                        or planed_item_selector == allure_full_name(item)):
                    return True if not is_inversion else False
            return False if not is_inversion else True

        selected, deselected = [], []
        for item in items:
            selected.append(item) if is_planed(item) else deselected.append(
                item)
        return selected, deselected
    else:
        return items, []
 def __init__(self):
     self.testplan = get_testplan()
     self.allure_ids = [test["id"]
                        for test in self.testplan] if self.testplan else []
     self.selectors = [test["selector"]
                       for test in self.testplan] if self.testplan else []
Esempio n. 5
0
 def __init__(self):
     self.testplan = get_testplan()