CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Artillery

$ artillery 官方出品 中风险
Artillery · 浏览器与网页抓取 · MPL-2.0 · macos / linux / windows

Artillery(artillery)可针对 HTTP API、WebSocket、Socket.IO 与 Playwright 浏览器脚本执行 YAML 负载测试或临时 artillery quick 探测。传入 --output report.json 可导出延迟分位数、错误统计与自定义指标供 CI 阈值校验。

FCRS-1.0 综合评分
84 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
npm install -g artillery
CLI vs MCP 选型建议 仅 CLI 可用

直接在 Shell 或 CI 中生成高并发流量并执行本地 Playwright/Node 测试场景,无 MCP 替代需求。

Agent 友好度体检单

✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 21 / 25

通过 artillery run 与 artillery quick 支持 --output <file>.json 导出完整结构化遥测数据、--quiet 与非交互执行,并支持 ensure 阈值断言。

  • Structured JSON output via artillery run --output report.json
  • Built-in ensure thresholds for non-zero CI exit codes
安全与权限边界 19 / 25

若 --count 或 phases 配置不当可能压垮远端服务或触发限流,需严格限定目标范围。

  • Bounded request counts in artillery quick and ensure assertions
安装与运行摩擦 12 / 15

通过 npm/npx 跨平台覆盖 macOS、Linux 与 Windows,依赖 Node.js 运行时及可选 Playwright 浏览器。

  • Standard npm install -g artillery and npx artillery
能力覆盖与边际价值 14 / 15

单工具统一支持多步骤用户旅程、CSV 参数化、WebSocket 与真实浏览器负载测试。

  • Covers HTTP, WebSockets, Socket.IO, and Playwright engines
维护与来源背书 9 / 10

由官方 artilleryio/artillery 基于 MPL-2.0 协议持续维护并拥有活跃版本迭代。

  • Official artilleryio/artillery repository
文档与可验证性 9 / 10

官方文档详尽覆盖 CLI 参数、测试引擎与 JSON 报告格式。

  • Comprehensive docs at https://www.artillery.io/docs

安全边界、鉴权与放权指南

鉴权方式
无需鉴权 环境变量密钥
凭证存储位置

可选从测试脚本或环境变量读取目标鉴权头;启用 Artillery Cloud 时使用 ARTILLERY_CLOUD_API_KEY。

潜在副作用
只读查询 本地写入 远端写入
费用与配额提示

MPL-2.0 开源 CLI 免费;分布式云端执行等企业功能需付费。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# 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 高频安全命令配方

只读查询(安全推荐)

运行有界快速 HTTP 检测并输出 JSON
artillery quick --count 5 --num 10 --output quick-report.json http://localhost:3000/health

向本地服务发送少量固定请求并将性能指标保存至 quick-report.json。

受控写入与预演

执行 YAML 场景测试并导出 JSON 指标
artillery run --output report.json test.yml

运行 test.yml 中定义的负载阶段并将完整延迟与计数器摘要写入 report.json。

核心优势

  • + --output report.json 可记录丰富的延迟分位数与状态码分布。
  • + 在同一套 YAML 语法中统一支持接口压测与 Playwright 浏览器压测。

注意事项与踩坑点

  • ! JSON 指标通过 --output 写入文件而非直接输出至标准输出,标准输出默认打印周期性进度摘要。
  • ! 基于 Node.js 的安装体积比单二进制 Go/Rust 压测工具更大。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI