1.下载安装allure
下载合适版本 https://github.com/allure-framework/allure2/releases,下载了2.13.0版本
解压文件并将 bin目录添加到Path环境变量中
验证allure:输入allure --version,返回版本信息则安装成功
2.安装pytest和allure-pytest
pip install pytest
pip install allure-pytest
3.执行测试用例
在项目根目录下执行如下命令,就会执行Test.py模块中的用例,生成report文件里面存放的是后面报告需要解析的json文件,包含了用例的所有信息。
执行这个Test.py模块下的用例,--alluredir=report 生成report目录存放数据,--clean-alluredir 清除原有的存放数据路径
pytest .\Test.py --alluredir=report --clean-alluredir