首页 > 解决方案 > 生成python单元测试生成的junit xml的html报告

问题描述

我有 junit 在 jenkins 的 xml fomrat 中生成的 python 单元测试报告。

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite name="pytest" errors="0" failures="0" skipped="1" tests="3" time="0.023" timestamp="2021-08-29T21:42:01.852698" hostname="infinity">
<testcase classname="tests.SimpleTest" name="test_fail" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_pass" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_skipped" time="0.000">
<skipped type="pytest.skip" message="demonstrating skipping">
/var/lib/jenkins/workspace/GithubExample/tests.py:10: demonstrating skipping
</skipped>
</testcase>
</testsuite>
</testsuites>

现在我想生成一个 html 报告,然后我可以使用 Publish HTML report 插件发布以从 confluence 访问。

现在在我的工作场所,我没有 junit 宏,也可能没有其他 html 生成插件,我拥有的是 xsltproc,

我尝试使用 xsltproc 生成 htmlreport,但它会引发错误

xsltproc test-result.xml stylesheet.xslt > index.html
warning: failed to load external entity "test-result.xml"
cannot parse test-result.xml

标签: jenkinsxsltjunitjenkins-plugins

解决方案


推荐阅读