← 返回 CLI 目录
Newman
$ newman 官方出品 中风险 Postman · 浏览器与网页抓取 · Apache-2.0 · macos / linux / windows
Newman 可直接在命令行与 CI 流水线中执行 Postman Collection v2 JSON 文件。配合 --reporters cli,json 与 --reporter-json-export,Agent 能运行现有 API 测试套件并精准排查断言失败。
FCRS-1.0 综合评分
83 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install newman CLI vs MCP 选型建议 仅 CLI 可用
在 CI/Shell 中确定性执行既有 Postman 集合即可,无需依赖 Postman MCP 服务。
Agent 友好度体检单
✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 21 / 25
支持 --reporters json、--reporter-json-export、--color off 与 --bail,但 JSON 报告体积可能较大且会执行内嵌 JS。
- Supports
--reporters json,--reporter-json-export, and--color off
安全与权限边界 19 / 25
会在 Node 中执行集合内的预请求/测试脚本,并按集合定义发起可能修改远端状态的 HTTP 请求。
- Collection JSON files can invoke arbitrary pre-request JS and mutating HTTP calls
安装与运行摩擦 13 / 15
可通过 npm、npx、brew 与官方 Docker 镜像跨平台安装。
- Distributed on npm and Homebrew
能力覆盖与边际价值 13 / 15
团队已有 .postman_collection.json 资产时价值极高;若从零编写测试,hurl 更轻量。
- Full Postman Collection v2 compatibility
维护与来源背书 9 / 10
Postman Labs 官方开源项目(postmanlabs/newman),Apache-2.0 协议。
- Official
postmanlabs/newmanrepository
文档与可验证性 8 / 10
Postman 官方文档与 --help 参数说明齐全。
- Official docs at learning.postman.com
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 环境变量密钥 本地配置文件
凭证存储位置
从环境文件(-e env.json)或 --env-var 参数读取密钥;自身不持久化凭据。
潜在副作用
只读查询 本地写入 远端写入
费用与配额提示
免费开源(Apache-2.0 协议)Node.js CLI。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Newman Agent Rules - Always pass `--color off` and `--timeout-request <ms>` when running collections in agent shells. - Avoid printing `--env-var` secrets to stdout and audit collection scripts before running against live environments.
Agent 高频安全命令配方
只读查询(安全推荐)
以纯净命令行输出运行 Postman 集合
newman run collection.json --color off --bail --timeout-request 10000
禁用 ANSI 颜色(--color off),遇到首个失败即中止(--bail),并限制请求超时。
受控写入与预演
运行集合并导出 JSON 测试报告
newman run collection.json -e staging.env.json --reporters json --reporter-json-export newman-report.json --color off
加载环境文件并将结构化 JSON 执行结果写入 newman-report.json。
核心优势
- + 可在无头 CI 与 Agent 循环中直接复用既有 Postman 测试集合。
- +
--reporters json结合--color off提供干净的机器可读结果。
注意事项与踩坑点
- ! 包含完整响应体时导出的 JSON 报告体积较大。
- ! 相比纯文本
.hurl或.bru文件,Postman 集合 JSON 较为臃肿。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI