```
allure --version
allure : 无法将“allure”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
```
原因:只是安装了allure-pytest插件,没有下载allure
解决方法:
1、下载alllure allure下载地址 解压在pytest的所在目录。
【C:\Users\unionstrong\AppData\Local\Programs\Python\Python310】
2、配置allure的环境变量,检查
进入 高级系统设置 - 环境变量 - 系统变量 - path - 编辑。[C:\Users\unionstrong\AppData\Local\Programs\Python\Python310\allure-2.22.4\bin]
注意:如没有安装java,需要安装java并配置java的环境变量,如图中,最后一行。
3、下载allure-pytest插件
pip install allure-pytest
4、cmd中输入allure,allure --version,查看环境变量是否配置成功
5、执行测试集,生成正常结果文件(json文件)
在编译器终端中输入 pytest -s --alluredir=【存放allure报告的路径】
或者 执行pytest.main(['-vs', './test_study_detail.py', '--alluredir=F:\\AUTOtest\\allure-report'])
eg:pytest -s --alluredir=D:\WorkSpace\PytestXdist PytestXdist
6、浏览器自动打开生成的allure报告
allure serve 【前一步中,执行结果文件路径】
eg:F:\AUTOtest> allure serve allure-report
报告打开如下图