1.下载allure至本地
链接: https://pan.baidu.com/s/1eZH35Vee90jKn8EqIoPKRg 提取码: mbeh
2.配置环境变量
open ~/.bash_profile
编辑 export PATH=$PATH:/Users/houmiaomiao/Documents/Program/allure-2.7.0/bin
source ~/.bash_profile
3.检查配置成功
allure --version
4.代码中使用allure
import pytest
import allure
@pytest.fixture(scope='function')
def login():
print("登录")
yield
print("登录完成")
@allure.feature('加入购物车')
def test_1(login):
print("测试用例1")
@allure.feature('加入购物车')
def test_2():
print("测试用例2"