小编典典

Python脚本从另一个测试结果生成JUnit报告

jenkins

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

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


阅读 391

收藏
2020-07-25

共1个答案

小编典典

我发现一个python模块https://bitbucket.org/db_atlass/python-junit-xml-output-
module/,看起来很适合我的需求。大卫·布莱克

# 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)
2020-07-25