ubuntu

Ubuntu Postman如何生成报告

小樊
39
2025-08-21 10:58:02
栏目: 智能运维

在Ubuntu上生成Postman报告需借助Newman工具,具体步骤如下:

  1. 安装Node.js和Newman:打开终端,依次运行sudo apt updatesudo apt install nodejs npm安装Node.js和npm,再通过sudo npm install -g newman全局安装Newman。
  2. 安装报告插件:安装newman-reporter-html插件以生成HTML报告,命令为sudo npm install -g newman-reporter-html
  3. 导出Postman集合和环境变量:在Postman中选择要导出的集合,点击“Export”保存为JSON文件;若需环境变量,点击右上角齿轮图标,选择环境变量并下载为JSON文件。
  4. 生成测试报告:打开终端,进入导出文件所在目录,运行命令newman run "集合文件名.json" -e "环境变量文件名.json" --reporters html --reporter-html-export "报告文件名.html",例如newman run "api-tests.postman_collection.json" -e "api-env.postman_environment.json" --reporters html --reporter-html-export "api-test-report.html"

0
看了该问题的人还看了