当前位置:网站首页>Pytest 可视化测试报告之 Allure
Pytest 可视化测试报告之 Allure
2022-07-04 17:48:00 【Wu_Candy】
Pytest报告生成
- 生成兼容Junit风格的报告 Junit风格xml报告:pytest—junitxml=path
- 生成HTML风格报告 Pytest-html报告:pytest—html=report.html Allure2报告pytest—alluredir=/tmp/my_allure_results
这篇文章主要讲解如何使用Allure来生成漂亮的测试报告。
执行步骤如下:
Step1、安装Allure
使用命令:pip install allure-pytest
Step2、下载Allure版本
https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.7.0/allure-2.7.0.zip
解压之后,将allure/bin目录添加到环境变量path中。
Windows系统添加环境变量如下图所示:
Mac系统添加环境变量如下图所示:
将以上截图中Allure的bin目录所在的路径添加到环境变量中
进入terminal后,输入命令:sudo vi ~/.bash_profile,
编辑添加: Export ALLURE=/Users/XXX/Downloads/allure-2.7.0/bin(说明:该路径如上图所示是allure的bin目录所在的路径)
Export PATH=PATH:ALLURE
添加效果如下图所示:
添加完成后使用按:ESC键并输入: wq! 保存退出
Step3、生成测试结果
在terminal里输入命令:pytest —alluredir ./result/ 去生成测试结果,如下图所示,会重新生成一个result目录来存放这些结果
同时terminal里也会将执行结果输出展示:
Step4:测试结果转换成测试报告
将测试结果文件转换生成测试报告。
使用命令:allure generate ./result/ -o ./report/ —clean 在terminal里输入该命令,命令执行成功后会生成report目录,如下图所示:
Step5:浏览器查看测试报告
点击report目录下的index.html文件并使用浏览器打开,效果图如下所示:
左边菜单栏中有很多选项,都是对测试case执行结果分析的不同形式的展示与说明,可视化效果非常漂亮,这里就不一一截图展示了,感兴趣的小伙伴们可以自行按照以上步骤操作实践来感受下Allure可视化报告的强大之处。
友情提示:“无量测试之道”原创著作,欢迎关注交流,禁止第三方不显示文章来源时转载。
边栏推荐
- Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
- From automation to digital twins, what can Tupo do?
- Mxnet implementation of googlenet (parallel connection network)
- Have you guys ever used CDC direct Mysql to Clickhouse
- 1672. 最富有客户的资产总量
- 神经网络物联网应用技术就业前景【欢迎补充】
- Use canal and rocketmq to listen to MySQL binlog logs
- 每日一题(2022-07-02)——最低加油次数
- 其他InterSystems %Net工具
- Scala基础教程--15--递归
猜你喜欢
Torchdrug tutorial
Principle and application of ThreadLocal
神经网络物联网应用技术就业前景【欢迎补充】
Scala basic tutorial -- 13 -- advanced function
DeFi生态NFT流动性挖矿系统开发搭建
Rookie post station management system based on C language
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
使用canal配合rocketmq监听mysql的binlog日志
Mxnet implementation of googlenet (parallel connection network)
Basic tutorial of scala -- 16 -- generics
随机推荐
Scala基础教程--14--隐式转换
Download the first Tencent technology open day course essence!
信息学奥赛一本通 1336:【例3-1】找树根和孩子
性能优化之关键渲染路径
Have you guys ever used CDC direct Mysql to Clickhouse
Uni app and uviewui realize the imitation of Xiaomi mall app (with source code)
Using SSH
【uniapp】uniapp开发app在线预览pdf文件
ByteDance dev better technology salon was successfully held, and we joined hands with Huatai to share our experience in improving the efficiency of web research and development
BI技巧丨权限轴
国元期货是正规平台吗?在国元期货开户安全吗?
Caché JSON 使用JSON适配器
Perfect JS event delegation
2021 Hefei informatics competition primary school group
From automation to digital twins, what can Tupo do?
Scala basic tutorial -- 13 -- advanced function
2022 ByteDance daily practice experience (Tiktok)
Torchdrug tutorial
Process of manually encrypt the mass-producing firmware and programming ESP devices
How is the entered query SQL statement executed?