pytest-allure安装之后,无法使用allure指令问题解决

本文最后更新于:2024年5月29日 凌晨

1、问题现象

在执行pip install pytest-allure安装完成allure后,出现无法识别allure指令的情况:

1
2
allure: The term 'allure' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

image-20240522191407423

2、解决方法

安装allure命令行:

1
npm install -g allure-commandline --save-dev

image-20240522191345993

验证修复情况:

1
allure --version

正常看到allure版本号则恢复正常:

image-20240522191809181

后面则可以通过pytest生成allure测试报告了:

1
2
3
pytest [测试用例] -s -q --alluredir=./result
# 将测试结果生成静态页面
allure serve ./result/

image-20240522191326092

参考:

https://stackoverflow.com/questions/70885555/allure-report-generation-fails-with-message-allure-is-not-recognized-as-the-n

https://www.npmjs.com/package/allure-commandline


pytest-allure安装之后,无法使用allure指令问题解决
http://www.codestar.top/2024/05/28/TestSkill/pytest-allure安装之后,无法使用allure指令问题解决/
作者
mini小新
发布于
2024年5月28日
更新于
2024年5月29日
许可协议