使用环境及预置条件
开发工具:pycharm
操作系统:win10
开发语言:python3.6
使用库:pytest4.0,pytest-allure-adaptor
注意不要安装allure-pytest该库,否则会出现option names {'alluredir'} already added错误
1,安装PowerShell (win10自带有,其他系统自行安装)
2,打开PowerShell,输入命令:
set-executionpolicy remotesigned -s cu
再输入
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
输入scoop help 可查看scoop命令列表
出现如上文字内容说明scoop安装成功。
3,在PowerShell命令窗口输入 scoop install allure
4,进入存放用例py文件的目录下,执行
py.test --alluredir=reports
存放用例的目录中会多一个reports文件夹,里面是各种txt和json文件
再执行
allure generate reports
存放用例的目录中会多一个allure-reports文件夹,更新allure-reports文件夹内容使用
allure generate reports --clean
注意,用火狐浏览器打开index.html文件,不要用chrome,ie浏览器打开,打开效果截图如下:
2020-04-14更新
新问题:Allure报告用火狐,chrome打开都报404,结果换成Windows10自带的Microsoft Edge浏览器就可以正常打开了
相关环境版本:
pytest:4.0.0
pytest-allure-adaptor:1.7.10
allure:2.13.2