Python脚本从另一个测试结果生成JUnit报告 [英] Python script to generate JUnit report from another testing result

查看:305
本文介绍了Python脚本从另一个测试结果生成JUnit报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个验收测试用例,结果为纯文本.我想使用Jenkins来显示结果,并且JUnit格式适合我.

I have an acceptance test case, the result is plain text. I want to use Jenkins to show the result, and the JUnit format is suitable for me.

因此,我想检查是否存在用于生成JUnit格式XML的python代码,以便可以轻松添加我的解析代码.

So I want to check whether there is existing python code to generate JUnit-format XML, so that I can easily just add my parsing code.

相关问题.

推荐答案

我找到了一个python模块 https://bitbucket.org/db_atlass/python-junit-xml-output-module/,看起来很适合我的需求.大卫·布莱克在那里

I found one python module https://bitbucket.org/db_atlass/python-junit-xml-output-module/ , looks fit to my need. thx David Black there

# code snippet for the usage
""" a short example of how to use this module """
test_cases = []
for i in range(0, 5):
    type_c = ""
    if i % 2 == 0:
        type_c = "failure"
    test_cases.append(TestCase(i, str(i) + "contents", type_c) )

junit_xml = JunitXml("demo test example", test_cases)

这篇关于Python脚本从另一个测试结果生成JUnit报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆