如何在 Python 中生成 HTML 单元测试输出?

发布于 2024-08-11 14:34:32 字数 781 浏览 3 评论 0 原文

我正在寻找任何方法来在 HTML 摘要中显示 Python 单元测试的结果。对于 Java 和 Ruby 有这样的工具...尚未找到任何似乎可以为 Python 执行此操作的工具。那里有吗?

JUnit HTML 输出:

alt 文本
(来源:ibm.com

Ruby RSpec 输出:

alt text
(来源:natontesting.com

I'm looking for any way to display the results of Python unit tests in an HTML summary. There are tools like this for Java and Ruby... haven't yet located any tools that seem to do this for Python. Are there any out there?

JUnit HTML output:

alt text
(source: ibm.com)

Ruby RSpec output:

alt text
(source: natontesting.com)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空心↖ 2024-08-18 14:34:32

现在有一些方法可以使用 Python 来实现这一点。使用 pytest,例如:

pip install pytest pytest-html

然后:

pytest --html=report.html --self-contained-html

pytest 的 HTML 结果

There are now ways to do it using Python. Using pytest, for example:

pip install pytest pytest-html

And then:

pytest --html=report.html --self-contained-html

Results in HTML of pytest

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文