當前位置: 首頁>>代碼示例>>Python>>正文


Python TestSuite.to_xml_string方法代碼示例

本文整理匯總了Python中junit_xml.TestSuite.to_xml_string方法的典型用法代碼示例。如果您正苦於以下問題:Python TestSuite.to_xml_string方法的具體用法?Python TestSuite.to_xml_string怎麽用?Python TestSuite.to_xml_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在junit_xml.TestSuite的用法示例。


在下文中一共展示了TestSuite.to_xml_string方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: print_result_cache_junitxml

# 需要導入模塊: from junit_xml import TestSuite [as 別名]
# 或者: from junit_xml.TestSuite import to_xml_string [as 別名]
def print_result_cache_junitxml(dict_synonyms, suspicious_policy, untested_policy):
    test_cases = []
    mutant_list = list(select(x for x in Mutant))
    for filename, mutants in groupby(mutant_list, key=lambda x: x.line.sourcefile.filename):
        for mutant in mutants:
            tc = TestCase("Mutant #{}".format(mutant.id), file=filename, line=mutant.line.line_number, stdout=mutant.line.line)
            if mutant.status == BAD_SURVIVED:
                tc.add_failure_info(message=mutant.status, output=get_unified_diff(mutant.id, dict_synonyms))
            if mutant.status == BAD_TIMEOUT:
                tc.add_error_info(message=mutant.status, error_type="timeout", output=get_unified_diff(mutant.id, dict_synonyms))
            if mutant.status == OK_SUSPICIOUS:
                if suspicious_policy != 'ignore':
                    func = getattr(tc, 'add_{}_info'.format(suspicious_policy))
                    func(message=mutant.status, output=get_unified_diff(mutant.id, dict_synonyms))
            if mutant.status == UNTESTED:
                if untested_policy != 'ignore':
                    func = getattr(tc, 'add_{}_info'.format(untested_policy))
                    func(message=mutant.status, output=get_unified_diff(mutant.id, dict_synonyms))

            test_cases.append(tc)

    ts = TestSuite("mutmut", test_cases)
    print(TestSuite.to_xml_string([ts])) 
開發者ID:boxed,項目名稱:mutmut,代碼行數:25,代碼來源:cache.py

示例2: _generate_report

# 需要導入模塊: from junit_xml import TestSuite [as 別名]
# 或者: from junit_xml.TestSuite import to_xml_string [as 別名]
def _generate_report(self):
        """Generate a TestSuite report.

        Generate a TestSuite report from the collected TaskData and HostData.
        """
        test_cases = []

        for task_uuid, task_data in self._task_data.items():
            if task_data.action == 'setup' and \
                    self._include_setup_tasks_in_report == 'false':
                continue

            for host_uuid, host_data in task_data.host_data.items():
                test_cases.append(self._build_test_case(task_data, host_data))

        test_suite = TestSuite(self._playbook_name, test_cases)
        report = TestSuite.to_xml_string([test_suite])

        output_file = os.path.join(self._output_dir, '%s-%s.xml' % (
            self._playbook_name, time.time()))

        with open(output_file, 'wb') as xml:
            xml.write(to_bytes(report, errors='surrogate_or_strict')) 
開發者ID:redhat-openstack,項目名稱:infrared,代碼行數:25,代碼來源:junit_report.py

示例3: run_api_tests

# 需要導入模塊: from junit_xml import TestSuite [as 別名]
# 或者: from junit_xml.TestSuite import to_xml_string [as 別名]
def run_api_tests(args, data_format):
    endpoints = []
    for i in range(len(args.host)):
        if args.port[i] == 0:
            args.port[i] = None
        selector = None
        if len(args.selector) == len(args.host):
            selector = args.selector[i]
        endpoints.append({"host": args.host[i], "port": args.port[i], "version": args.version[i],
                          "selector": selector})
    results = run_tests(args.suite, endpoints, [args.selection])
    if data_format == "xml":
        formatted_test_results = format_test_results(results, endpoints, "junit", args)
        return TestSuite.to_xml_string([formatted_test_results], prettyprint=True)
    else:
        formatted_test_results = format_test_results(results, endpoints, "json", args)
        return json.loads(formatted_test_results) 
開發者ID:AMWA-TV,項目名稱:nmos-testing,代碼行數:19,代碼來源:NMOSTesting.py

示例4: print_junit_xml

# 需要導入模塊: from junit_xml import TestSuite [as 別名]
# 或者: from junit_xml.TestSuite import to_xml_string [as 別名]
def print_junit_xml(self):
        ts = self.get_test_suites()
        print(TestSuite.to_xml_string(ts)) 
開發者ID:bridgecrewio,項目名稱:checkov,代碼行數:5,代碼來源:report.py


注:本文中的junit_xml.TestSuite.to_xml_string方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。