当前位置:网站首页>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可视化报告的强大之处。
友情提示:“无量测试之道”原创著作,欢迎关注交流,禁止第三方不显示文章来源时转载。
边栏推荐
猜你喜欢
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
整理混乱的头文件,我用include what you use
Angry bird design based on unity
Scala basic tutorial -- 17 -- Collection
node_exporter部署
Bi skills - permission axis
Go微服务(二)——Protobuf详细入门
Basic tutorial of scala -- 16 -- generics
Nebula Importer 数据导入实践
奥迪AUDI EDI INVOIC发票报文详解
随机推荐
Go microservice (II) - detailed introduction to protobuf
Mxnet implementation of googlenet (parallel connection network)
2019年蜀山区第十五届青少年信息学竞赛
Esp32-c3 introductory tutorial questions ⑫ - undefined reference to ROM_ temp_ to_ power, in function phy_ get_ romfunc_ addr
Detailed explanation of issues related to SSL certificate renewal
MXNet对GoogLeNet的实现(并行连结网络)
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Nebula Importer 数据导入实践
[mathematical basis of machine learning] (I) linear algebra (Part 1 +)
Caché WebSocket
启牛开的证券账户安全吗?
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
What if the self incrementing ID of online MySQL is exhausted?
测试工程师如何“攻城”(上)
2021 合肥市信息学竞赛小学组
Download the first Tencent technology open day course essence!
Lex and yacc based lexical analyzer + parser
奥迪AUDI EDI INVOIC发票报文详解
Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii
Scala basic tutorial -- 12 -- Reading and writing data