Artillery
$ artillery 官方出品 中风险Artillery(artillery)可针对 HTTP API、WebSocket、Socket.IO 与 Playwright 浏览器脚本执行 YAML 负载测试或临时 artillery quick 探测。传入 --output report.json 可导出延迟分位数、错误统计与自定义指标供 CI 阈值校验。
npm install -g artillery 直接在 Shell 或 CI 中生成高并发流量并执行本地 Playwright/Node 测试场景,无 MCP 替代需求。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
通过 artillery run 与 artillery quick 支持 --output <file>.json 导出完整结构化遥测数据、--quiet 与非交互执行,并支持 ensure 阈值断言。
- Structured JSON output via
artillery run --output report.json - Built-in
ensurethresholds for non-zero CI exit codes
若 --count 或 phases 配置不当可能压垮远端服务或触发限流,需严格限定目标范围。
- Bounded request counts in
artillery quickandensureassertions
通过 npm/npx 跨平台覆盖 macOS、Linux 与 Windows,依赖 Node.js 运行时及可选 Playwright 浏览器。
- Standard
npm install -g artilleryandnpx artillery
单工具统一支持多步骤用户旅程、CSV 参数化、WebSocket 与真实浏览器负载测试。
- Covers HTTP, WebSockets, Socket.IO, and Playwright engines
由官方 artilleryio/artillery 基于 MPL-2.0 协议持续维护并拥有活跃版本迭代。
- Official
artilleryio/artilleryrepository
官方文档详尽覆盖 CLI 参数、测试引擎与 JSON 报告格式。
- Comprehensive docs at
https://www.artillery.io/docs
安全边界、鉴权与放权指南
可选从测试脚本或环境变量读取目标鉴权头;启用 Artillery Cloud 时使用 ARTILLERY_CLOUD_API_KEY。
MPL-2.0 开源 CLI 免费;分布式云端执行等企业功能需付费。
# Artillery Agent Rules - Always pass `--output <file>.json` when capturing metrics for automated parsing. - Keep `artillery quick --count` and `--num` small and never load-test production or unowned URLs without explicit approval.
Agent 高频安全命令配方
只读查询(安全推荐)
artillery quick --count 5 --num 10 --output quick-report.json http://localhost:3000/health
向本地服务发送少量固定请求并将性能指标保存至 quick-report.json。
受控写入与预演
artillery run --output report.json test.yml
运行 test.yml 中定义的负载阶段并将完整延迟与计数器摘要写入 report.json。
核心优势
- +
--output report.json可记录丰富的延迟分位数与状态码分布。 - + 在同一套 YAML 语法中统一支持接口压测与 Playwright 浏览器压测。
注意事项与踩坑点
- ! JSON 指标通过
--output写入文件而非直接输出至标准输出,标准输出默认打印周期性进度摘要。 - ! 基于 Node.js 的安装体积比单二进制 Go/Rust 压测工具更大。