pytest 生成allure报告

 

前置条件:已有测试用例代码,可运行

配置allure步骤如下:

1.配置allure环境变量

下载地址 https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/

解压后,配置环境变量 

验证

 

 

2.python环境中安装对应插件

pip install allure-pytest

 

 

 

 3.生成报告并查看

直接在pytest.ini里面加入参数 --alluredir=./report/data

运行pytest.main()就会生成对应数据

 

 

方式1:直接allure serve打开

 

 

方式2:将报告转化为html格式,打开查看

allure generate ./report/data -o ./report/html --clean

allure open -h 127.0.0.1 -p 8888 ./report/html  (当然也可以浏览器直接打开./report/html/index.html)

参考 https://www.cnblogs.com/lzyying/p/13755863.html

 

 

关于allure的进一步定制化,参考

https://www.cnblogs.com/xyztank/articles/13530638.html

https://www.jianshu.com/p/ed6c0c6c29c5

posted @ 2022-04-06 16:13  huangyn  阅读(313)  评论(0)    收藏  举报