python - 是否可以在 python-unittest 中生成 Allure 报告?
问题描述
我在 Pytest 中找到了魅力报告的解决方案。但我需要在 python-unittest 中生成魅力报告。可能吗?
解决方案
通过添加魅力装饰器
- @allure.story('故事/需求名称')
- @allure.feature('功能名称')
- @allure.testcase("测试用例名称")
例如
def test_nameOfTheTest(self):
with allure.step("Open browser"):
或在您可以使用的定义中
@allure.step("Open application")
def open_application(self):
运行测试:
python -m pytest nameOftheFile.py(considering its in the root) --alluredir ./results
得到结果:
allure serve ./results/
希望这可以帮助你
推荐阅读
- python - 在 Python3 中从命令行和配置文件参数映射来自字典的变量
- c++ - 临时对象的堆栈空间是否被重用?
- azure - 使用 PowerShell 为 Azure 认知搜索配置 IP 防火墙
- javascript - 通过我的 javascript 应用程序将日志发送到新的遗物
- java - android问题上的Opengl es与投影矩阵上的对象opsition
- php - 无法通过 Mercury SMTP 服务器从 PHP 发送电子邮件:553 我们不中继非本地邮件,抱歉
- html - Angular mat-tab-label customization
- python - 对 python requests_mock 提供大量响应
- c# - C#如何将两个DataTable Row合并为一行
- javascript - Laravel (7.x) nova (3.10) 动作 - 在 fields() 上获取当前模型实例