找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 84|回复: 0

postman之newman的使用

[复制链接]

10

主题

0

回帖

52

积分

注册会员

积分
52
发表于 2023-4-11 15:24:54 | 显示全部楼层 |阅读模式
newman简介:

newman是为Postman而生, 专门用来运行Postman编写好的脚本;使用newman, 你可以很方便的用命令行来执行postman collections

一、安装1.安装node.js
2.安装newman
npm install -g newman
3.安装newman的html报告生成
npm install -g newman-reporter-html
4.安装newman的htmlextra报告生成
npm install -g newman-reporter-htmlextra

二、使用1.导出postman脚本和环境变量
2.用 newman run "导出的.json文件存放路径" --reporters html --reporter-html-export的方式运行



三、举例




输出报告时使用的命令:  
-r html,json,junit 指定生成html,json,xml形式的测试报告    
--reporter-json-export jsonReport.json 生成json格式的测试报告    
--reporter-junit-export xmlReport.xml 生成xml格式的测试报告    
--reporter-html-export htmlReport.html 生成html格式的测试报告    
默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下
比如:


htmlextra 使用
  使用htmlextra套件生成比较高级的html报告
  使用方法和html的相同,需要安装htmlextra,命令行中输入:

命令行中执行命令生成测试报告




常见问题:
1.当运行出现unable to verify the first certificate,可在命令后面添加 --insecure

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Sobey-IBG-BBS

GMT+8, 2025-12-6 14:37 , Processed in 0.018260 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表