python环境下,集成allure
首先打开Allure官网:https://docs.qameta.io/allure/
![](https://img-blog.csdnimg.cn/3a7a8c17b4ad4fb9be5e238a824c0404.png)
选择对应平台的安装方式, 最下面有通用安装方法:
![](https://img-blog.csdnimg.cn/e6e729d3c1734a398acb3460e307e79f.png)
1.去maven central下载一个新版本的zip ;
2.下载到本地后解压;
3. 打开到bin目录;
4. windosw使用allure.bat ,unix使用allure;
5.将allure加入环境变量(我的电脑-右键属性-高级系统设置-环境变量-找到path将刚解压好的allure的bin目录配置进去即可)。
windows下可以使用cmd命令,输入allure看环境变量是否配置成功。allure --version查看对应的版本。
第二步,继续看官网,与pytest集成,安装allure库,pip install allure-pytest
![](https://img-blog.csdnimg.cn/28b81944598f4b70b563999988bdf8f2.png)
第三步,使用allure生产测试报告(json格式),并使用allure服务进行查看
生产报告:pytest --alluredir=你要生产报告的地方
查看报告:allure serve alluredir的路径
eg:pytest.main(["-s","-v","-m","smoke","--alluredir=report/allure_report"])运行后,会在report/allure_report目录下生产allure的测试报告,在pycharm控制台执行allure serve 项目的相对目录/report/allure_report就会生产在线的allure报告。
![](https://img-blog.csdnimg.cn/cae57d8dabd74dedac7afeaf4aaa6aae.png)
左下角可以选择切换语言。
如果想要看趋势,需要继承jenkins。