温馨提示×

Linux版Postman如何生成报告

小樊
59
2025-06-04 15:59:34
栏目: 智能运维

在Linux版Postman中生成测试报告,可以使用newman命令行工具。以下是详细的步骤:

安装newman

  1. 下载并安装Node.js
  1. 全局安装newman
npm install -g newman

生成测试报告

  1. 导出测试用例
  • 将所有的接口测试用例以JSON文件导出保存。
  1. 执行测试脚本并生成报告
newman run your-collection.json -r html --reporter-html-export all --output ./report
  • your-collection.json:你的测试集合文件。
  • -r html:指定使用HTML报告格式。
  • --reporter-html-export all:导出所有测试结果。
  • --output ./report:指定输出报告的目录。

自定义报告

  • 禁用代码语法突出显示
newman run collection.json -r htmlextra --reporter-htmlextra-noSyntaxHighlighting
  • 更改浏览器选项卡标题
newman run collection.json -r htmlextra --reporter-htmlextra-browserTitle "自定义测试报告标题"
  • 修改测试报告标题文案
newman run collection.json -r htmlextra --reporter-htmlextra-title "自定义自动化测试报告"

以上步骤可以帮助你在Linux系统上使用Postman生成测试报告,并且可以根据需要自定义报告的显示效果。

0