简体   繁体   English

如何使用 pytest-bdd 在诱惑报告中设置严重性级别

[英]How to set the severity level in allure report, using pytest-bdd

I am using pytest-bdd with allure to generate the reports, In generated allure report i can see the severity level is NORMAL by default, how can i set the Severity level as i needed.Thanks in advance.我正在使用带有 allure 的 pytest-bdd 生成报告,在生成的 allure 报告中,我可以看到严重性级别默认为 NORMAL,如何根据需要设置严重性级别。提前致谢。

Screenshot of allure report诱惑报告截图

You can add severity to your allure report by @severity decorator.您可以通过@severity 装饰器将严重性添加到您的魅力报告中。

First, you need to import severity and severity level from allure and add it to pytest-bdd test steps.首先,您需要从 allure 中导入严重性和严重性级别,并将其添加到 pytest-bdd 测试步骤中。

For example:例如:

from allure import severity, severity_level

@severity(severity_level.CRITICAL)
@scenario('test_user.feature', 'Check user list by page')
def test_check_user_list_by_page():
    """Check user list by page."""

It's possible via Overhave usage: https://github.com/Tinkoff/overhave可以通过Overhave使用: https ://github.com/Tinkoff/overhave

For example:例如:

@severity.critical
Feature: My feature

Scenario: My scenario
  When I am user
  ...

Full example from framework documentation is here: https://github.com/Tinkoff/overhave/blob/master/docs/includes/feature_example.rst框架文档的完整示例在这里: https ://github.com/Tinkoff/overhave/blob/master/docs/includes/feature_example.rst

You will get necessary severity level in Allure report after test is finished.测试完成后,您将在 Allure 报告中获得必要的严重性级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM