【问题标题】:In pytest-html, is there a way to combine html reports of 2 different pytest runs?在 pytest-html 中,有没有办法组合 2 个不同 pytest 运行的 html 报告?
【发布时间】:2021-11-26 11:55:00
【问题描述】:

基本上我有一个场景,我需要分别运行一组并行 pytest 和另一组串行 pytest。 每个都会生成单独的 pytest-html 报告。 但我正在寻找结合生成的报告的解决方案。 例如: py.test -n auto -m "非串行" --dist=loadfile --html=report1.html py.test -n auto -m "serial" --dist=loadfile --html=report2.html

有没有办法结合report1.html和report2.html生成单个html报告?

【问题讨论】:

  • 不,没有 HTML 报告的组合。你必须自己实现。
  • 正如@hoefling 所说,这是不可能的,GitHub 上有一个错误报告跟踪它。 github.com/pytest-dev/pytest-html/issues/183 虽然人们使用了一种解决方法: * 使用 pytest 的 junit 功能编写 junit/xunit/xunit2 报告。 * 将单元报告与 junitparser 结合起来。 * 使用 junit2html 生成 HTML 报告。
  • 有一个新的实用程序可以做到这一点。我用过它,它对我来说效果很好。 github.com/akavbathen/pytest_html_merger

标签: pytest pytest-html pytest-xdist


【解决方案1】:

Pytest HTML 合并

有一个新实用程序可以合并多个pytest-html 报告。

我在工作场所使用过它,对我们来说效果很好。

假设你在当前目录./下有多个html报告。

安装

pip install pytest-html-merger

用法

pytest_html_merger -i ./ -o ./merged.html

将生成统一的pytest-html 报告。

已在 Linux 上测试,但也应该可以在 Windows 上运行。

github页面链接

https://github.com/akavbathen/pytest_html_merger

享受吧!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    • 2022-10-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多