当前位置:网站首页>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可视化报告的强大之处。
友情提示:“无量测试之道”原创著作,欢迎关注交流,禁止第三方不显示文章来源时转载。
边栏推荐
- 问下各位大佬有用过cdc直接mysql to clickhouse的么
- 每日一题(2022-07-02)——最低加油次数
- 基于unity的愤怒的小鸟设计
- 2022 ByteDance daily practice experience (Tiktok)
- Go微服务(二)——Protobuf详细入门
- 工厂从自动化到数字孪生,图扑能干什么?
- 26. Delete the duplicate item C solution in the ordered array
- Basic tutorial of scala -- 16 -- generics
- Download the first Tencent technology open day course essence!
- 完善的js事件委托
猜你喜欢
随机推荐
资料下载 丨首届腾讯技术开放日课程精华!
Use canal and rocketmq to listen to MySQL binlog logs
其他InterSystems %Net工具
My colleagues quietly told me that flying Book notification can still play like this
Scala基础教程--18--集合(二)
Leetcode fizzbuzz C # answer
数组中的第K个最大元素
[opencv introduction to mastery 9] opencv video capture, image and video conversion
使用canal配合rocketmq监听mysql的binlog日志
物联网应用技术的就业前景和现状
C # implementation defines a set of SQL statements that can be executed across databases in the middle of SQL (detailed explanation of the case)
876. Intermediate node of linked list
基于NCF的多模块协同实例
大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
prometheus安装
Using SSH
Other InterSystems%net tools
Detailed explanation of issues related to SSL certificate renewal
Cache é JSON uses JSON adapters
DeFi生态NFT流动性挖矿系统开发搭建









