python - 如何使用 pytest-html 将测试步骤写入生成的 html 报告?
问题描述
我找不到将字符串添加到代表我的测试步骤的 HTML 报告的方法。
我在https://pypi.org/project/pytest-html/中看到 我应该尝试使用:
extra.text('Add some simple Text')
但似乎它不起作用。
from pytest_html import extras
class FirstFeatureTests:
def setup_class(self):
print("\n------------ in setup_class ------------")
def teardown_class(self):
print("------------ in teardown_class ------------")
@mark.example
def test_1_first_feature(self):
print("starting test !!!!!")
extras.text("step 1: ")
extras.text('step 2: ')
assert True
我希望每个测试都包含测试步骤,这些测试步骤表示为带有信息性描述的字符串。
有什么办法吗?
解决方案
推荐阅读
- c++ - 为什么c++编译器在某些情况下不生成默认构造函数而在其他情况下生成
- python - 如何在 python 中的 subprocess.run 中运行复杂的查询
- vue.js - 如何计算 Vuejs 中三个组件的总数?
- tinymce - 如何找出 HCL Connections 中安装了哪个 TinyMCE 版本?
- javascript - Node.js 和 OracleDB。从数据库中选择对象
- asp.net - 发布我的项目后,“不合并”选项不起作用
- wpf - 需要在鼠标单击时聚焦放置在滚动查看器内的网格
- jquery - jQuery $.get() 不工作并调用 express get
- angular - 基于打字稿数据对象的角表行跨度和列跨度
- excel - 覆盖结果行,同时将行粘贴到目标工作表