pytest使用笔记(二)——pytest+allure配置使用

pytest使用笔记(二)——pytest+allure配置使用

 使用环境及预置条件

开发工具: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命令列表

pytest使用笔记(二)——pytest+allure配置使用

出现如上文字内容说明scoop安装成功。

3,在PowerShell命令窗口输入 scoop install allure

pytest使用笔记(二)——pytest+allure配置使用

4,进入存放用例py文件的目录下,执行

 py.test --alluredir=reports

pytest使用笔记(二)——pytest+allure配置使用

 存放用例的目录中会多一个reports文件夹,里面是各种txt和json文件

pytest使用笔记(二)——pytest+allure配置使用

再执行

allure generate reports

存放用例的目录中会多一个allure-reports文件夹

pytest使用笔记(二)——pytest+allure配置使用

 

 注意,用火狐浏览器打开index.html文件,不要用chrome,ie浏览器打开,打开效果截图如下:

pytest使用笔记(二)——pytest+allure配置使用

 

pytest使用笔记(二)——pytest+allure配置使用

 

 

 

pytest使用笔记(二)——pytest+allure配置使用

 

posted @ 2019-01-26 15:38 爱穿衬衫 阅读(...) 评论(...) 编辑 收藏