コード例 #1
0
    def parse_testcase_list(cases_dict, parent=None):
        if __.is_testcase_topic(cases_dict):
            yield __.parse_testcase(cases_dict, parent)

        else:
            if not parent:
                parent = []

            parent.append(cases_dict)
            topics = cases_dict['topics'] or []

            for child in topics:
                for _ in parse_testcase_list(child, parent):
                    yield _
コード例 #2
0
    def parse_suite(suite_dict):
        """
        Convert suite dict (kind of topic) into TestSuite object.

        If one topic was not recognized as testcase, it is testsuite topic.

        :param suite_dict: suite dict
        :return: instance of TestSuite
        """
        suite = TestSuite()
        suite.name = suite_dict['title']
        suite.details = suite_dict['note']
        suite.testcase_list = []
        suite.sub_suites = []
        sub_topics = suite_dict.get('topics', [])

        for topic in sub_topics:
            if __.is_testcase_topic(topic):
                suite.testcase_list.append(__.parse_testcase(topic))
            else:
                suite.sub_suites.append(parse_suite(topic))

        return suite