@allure.severity(allure.severity_level.TRIVIAL)
时间: 2024-03-27 09:36:13 浏览: 27
@allure.severity是一个装饰器,用于设置测试用例的严重程度。它需要传入一个allure.severity_level枚举类型的参数,包括以下几个选项:
- BLOCKER:阻塞缺陷,影响系统无法继续进行
- CRITICAL:严重缺陷,影响系统主要功能
- NORMAL:普通缺陷,影响系统次要功能
- MINOR:次要缺陷,影响系统辅助功能
- TRIVIAL:轻微缺陷,不影响系统功能
示例如下:
```python
import allure
@allure.severity(allure.severity_level.CRITICAL)
def test_login():
assert login() == "success"
```
在这个示例中,我们使用@allure.severity装饰器将test_login测试用例设置为CRITICAL级别的严重程度,代表这个测试用例是一个严重缺陷,影响系统主要功能。如果这个测试用例在测试过程中失败了,测试报告中会将其标记为一个CRITICAL级别的缺陷,帮助测试人员更加快速、准确地定位问题。
相关问题
@allure.step
全的网络中创建一个安全的通道,保证数据的安全传输。
防火墙在网络安全中的应用非常广泛。防火墙可以用于保护企业内部网络、公共网络、政府网络@allure.step是一个装饰器,它可以将一个函数或方法转化为一个测试步骤,用于生成测试等。防火墙可以对网络流量进行监控和管理,保障网络的安全性。
第五章 防火报告。在测试代码中使用@allure.step可以将测试过程中的每个步骤记录下来,这有墙的未来发展方向
随着互联网技术的快速发展,防火墙的发展也助于测试人员更好地跟踪测试过程和排查问题。在生成的测试报告中,每个测试步骤都会有一个标题和详细说明,以及相关的附件信息(如截图、日志等)。
@allure.step怎么运行,举个例子
@allure.step是pytest-allure插件提供的装饰器,需要先安装pytest-allure插件。安装命令如下:
```
pip install pytest-allure
```
安装完毕后,在pytest测试代码中使用@allure.step即可将一个测试步骤记录到测试报告中。下面是一个示例:
```python
import allure
def test_login():
with allure.step("打开登录页面"):
open_login_page()
with allure.step("输入账号和密码"):
input_username_password()
with allure.step("点击登录按钮"):
click_login_button()
with allure.step("验证登录是否成功"):
assert is_login_success()
```
在这个示例中,我们定义了一个名为test_login的测试函数,并使用了@allure.step装饰器将测试过程分为了四个步骤:打开登录页面、输入账号和密码、点击登录按钮、验证登录是否成功。当我们运行这个测试函数时,pytest-allure插件会将这四个步骤记录到测试报告中,并在报告中显示出来。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)