让Postman生成不同格式测试报告

Postman-super-run

仓库地址:https://github.com/liyinchigithub/Postman-super-run

1.功能

  • 让 Postman 多种报告格式文件
  • 不打开 Postman 客户端软件,也能运行 Postman 脚本(collection.json)

2.自动生成 Postman 多种格式报告文件

报告文件位置 在eport文件夹下

报告格式
default htmlhtml
htmlextrahtml
junitxml
jsonjson
csvcsv
confluence wikiwiki
allurehtml
testrailapi
statsdapi
teamcityapi
influxdbapi

(1)htmlextraResults.html

img

(2)htmlResults.html

img

(3)junit xmlResults.xml

img

(4)jsonResults.json

img

(5)csvResults.csv

img

(6)default-template.wiki

img

(7)allureResults.html

img

allure serve

img

(8)statsd

(9)teamcity

teamcity 是JetBrains 持续集成框架工具,Postman-super-run将测试结果写入teamcity

img

 

(10)influxdb

influxdb是一种时序数据库,将测试结果直接写入到influxdb数据库中,结合Grafana可视化工具,可以把测试结果进行可视化展示。

2.使用

打开命令行窗口,输入

(1)Nodejs

版本
>8.17.0

如果你电脑还未安装配置nodejs环境,请参考:https://www.runoob.com/nodejs/nodejs-install-setup.html

如果已安装配置nodejs,可跳过此步骤

(2)安装

npm install

(3)将Postman脚本放入postmanCollection文件夹下

img

(4)修改引入Postman脚本路径的文件名

img

(5)运行

打开命令行终端窗口,输入

mocha 

img

(6)自动生成报告文件

img

3.目录

文件夹描述
postmanCollection存放示例Postman json collection脚本
report报告文件生成位置
teamplate报告模板,可在github上面查找各种postman关于hbs报告模板

4.Newman 触发事件

Newman 是 Postman团队(谷歌)开源的工具,用于执行Postman脚本(可以理解为运行环境)

事件描述
start集合运行的开始
start集合运行的开始
beforeIteration在迭代开始之前
beforeItem在项目执行开始之前(prerequest-> request-> test的集合)
beforePrerequest在prerequest脚本开始执行之前
prerequest后prerequest脚本执行完成
beforeRequest发送HTTP请求之前
request收到请求响应后
beforeTest在test脚本开始执行之前
test后test脚本执行完成
beforeScript在执行任何脚本(类型test或prerequest)之前
script执行任何脚本(类型为test或prerequest)后
item一个项目(整套prerequest-> request-> test)完成时
iteration迭代完成后
assertiontest脚本中完成的每个测试断言都会触发此事件
console每次console从任何脚本中调用函数时,都会传播此事件
exception当在scripts此事件中发生任何异步错误时,将触发
beforeDone运行完成之前触发的事件
done收集运行完成(有无错误)时,将发出此事件

5. Postman-super-run 编写时所用的工具及版本

Postman 7.23.0

Newman 5.0

htmlextra - This is an updated version of the standard HTML reporter containing a more in-depth data output and a few helpful extras

csv - This reporter creates a csv file containing the high level summary of the Collection run

json-summary - A Newman JSON Reporter that strips the results down to a minimum

teamcity - A reporter built to be used with the Team City CI server

testrail - A reporter built for Test Rail, the test case management tool

statsd - This reporter can be used to send the Collection run data to statsd and used on time series analytic tools like Grafana

confluence - Confluence reporter for Newman that uploads a Newman report on a Confluence page

influxdb - This reporter sends the test results information to InfluxDB which can be used from Grafana to build dashboards

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liyinchi1988

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值