当前位置: 首页>>代码示例>>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;未经允许,请勿转载。