allure的安装
打开terminal, 输入
pip3 install allure-pytest
安装allure包
下载地址:Central Repository: io/qameta/allure/allure-commandline
将allure添加路径到Path
#setting for allure
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=${PATH}:/Applications/Python3.7/allure-2.9.0/bin(这里填你自己的路径)
配置好了之后输入
allure --version
查看是否安装好
Postman+allure report
首先指定生成allure_report的文件夹
newman run MPA.postman_collection.json -r allure --reporter-allure-export ./allure_report
然后根据allure_report里保存的结果生成html文件
allure generate allure_report/ -o allure_html --clean
生成好了之后可以通过如下命令打开
allure open allure_html/
这样就能看到精美的allure报告了
上面介绍的是newman的命令的简单运用,如果我们想要跑一些稍微复杂的postman脚本,可以用如下方法
Postman里有环境变量需要配置的话,可以用如下命令,将跑完的结果放在指定的allure_report文件夹下
newman run MPA.postman_collection.json -e MPAStaging.postman_environment.json -r allure --reporter-allure-export ./allure_report
本文介绍了如何安装allure,包括在terminal中添加allure路径,验证安装成功。接着讲解如何结合Postman生成allure_report,并生成html报告进行查看。对于包含环境变量的复杂Postman脚本,也提供了运行及结果保存的方法。
1217

被折叠的 条评论
为什么被折叠?



