TOKREPO · 主题包
稳定

API 测试栈

Bruno / Hoppscotch / Hurl / k6 / Artillery / Locust — 开源替代 Postman + JMeter,无 SaaS 锁定。

6 个资产

这个 pack 装了什么

这个包收齐了把 Postman 和 JMeter 从现代工程团队替掉的 六个开源工具。Postman 2023 后涨价 + 强制云同步把不少团队推走;JMeter 还能用但 XML 脚本和 Java-only 生态在 JavaScript 原生方案面前显得难受。pack 把表面分成三个问题:交互探索 / CI 断言 / 压测。

# 资产 角色 亮点
1 Bruno 交互客户端 纯文本 .bru 文件,可 git 化
2 Hoppscotch 交互客户端 浏览器优先,可自建,实时协作
3 Hurl CI 跑器 纯文本 DSL,单二进制,Makefile 友好
4 k6 压测 JavaScript 脚本,Grafana 原生面板
5 Artillery 压测 YAML 场景,Playwright 驱动浏览器压力
6 Locust 压测 纯 Python 测试,分布式 master-worker

「交互客户端 + CI 跑器 + 压测」三角覆盖完整生命周期。写接口的时候用 Bruno / Hoppscotch 点;CI 里跑 Hurl 验契约没漂;发版前对 staging 跑 k6 / Artillery / Locust。

为什么离开 Postman 和 JMeter

三个推力同时来。Postman 2023 默认云端化 —— collection 同步到他们服务器,分享要账号,免费档缩水。JMeter UX 停留在 2005 —— XML 配置、GUI 优先,没有舒服的脚本故事。CI 要求 diff 可读 —— Postman 导出的 JSON 在 PR 里没法看;Bruno 的 .bru 和 Hurl 的纯文本 diff 干净,reviewer 一眼能看出问题。

迁移之外,这套开源 pack 还多了 Postman 没有的能力:

  • 同一个压测在三个引擎里跑做交叉验证(HTTP 重 k6,浏览器流 Artillery,Python 测试组就用 Locust)
  • Hurl 文件可以当文档 —— 粘进 runbook,任何会 curl 的工程师都看得懂
  • 自建 Hoppscotch 把企业数据留在自己网络 —— Postman 企业版按席位收费

一条命令装齐

# 把整个 pack 装进当前项目
tokrepo install pack/api-testing-stack

# 或只装单个
tokrepo install hurl
tokrepo install k6

TokRepo CLI 写好 Bruno collection 骨架、tests/api/*.hurl 目录、loadtest/ 文件夹(k6 / Artillery / Locust 模板)。每个资产单独带 GitHub Actions 和 GitLab CI 片段。

常见踩坑

  • k6 不预热就当生产数据。k6 默认爬升很快,从 1000 VU 起步前 30 秒服务都在填缓存,p99 看起来比真实差。用 stages 加 30-60 秒爬升期。
  • Hurl 断言比对 body 文本。断言在 JSON 路径上(jsonpath "$.user.id"),不要比子串。序列化器换空白或 key 顺序时文本比对会假阳性。
  • Bruno collection 不分 environments 就分享。Bruno 支持按环境变量;凭据直接写进 .bru 文件就是把密钥泄漏到 git 历史。用 bru env.env.local 模式。
  • Locust 单机超高 RPS。Locust GIL 决定单 Python 进程上限大概 1k-2k RPS;用 --master + 多 --worker,或者超过 5k RPS 直接换 k6。
  • 只看吞吐忘了 p99。10k RPS p50=20ms 但 p99=8s 没意义。永远导延迟直方图,不能只看均值。

跟其他 pack 的关系

工作流编排 天然搭(用 Inngest / Prefect cron 跑夜间压测),跟 静态站 & 文档生成器 搭(发布跟 Hurl 测试一致的 OpenAPI 文档,文档和测试同源)。要做测试运行的完整可观测,再叠 图表 & 数据可视化 把 k6 CSV 输出渲染进 Apache ECharts 或 Grafana。

安装 · 一行命令
$ tokrepo install pack/api-testing-stack
丢给 agent,或粘到终端
包内含什么

6 个资产打包就绪

Script#01
Bruno — Open-Source IDE for API Exploration & Testing

Bruno is an open-source IDE for exploring and testing APIs — a lightweight, offline-first alternative to Postman and Insomnia. Stores collections as plain text files in your filesystem so they version-control naturally with Git.

by Script Depot·92 views
$ tokrepo install bruno-open-source-ide-api-exploration-testing-89ca3775
Agent#02
Hoppscotch — Open-Source API Development Platform

Test APIs with a beautiful UI. REST, GraphQL, WebSocket, SSE, and gRPC. Self-hostable Postman alternative. 78K+ GitHub stars.

by AI Open Source·101 views
$ tokrepo install hoppscotch-open-source-api-development-platform-1a83c479
Script#03
Hurl — Run and Test HTTP Requests with Plain Text

Hurl is a command-line tool that runs HTTP requests defined in a simple plain text format. Chain requests, capture values, assert responses, and use it for API testing in CI/CD. Written in Rust on top of libcurl for maximum compatibility.

by Script Depot·84 views
$ tokrepo install hurl-run-test-http-requests-plain-text-42405722
Script#04
k6 — Modern Load Testing Tool Using Go and JavaScript

k6 is a modern load testing tool built by Grafana Labs. Write test scripts in JavaScript, run them in a high-performance Go runtime. Developer-centric with CLI-first workflow, CI/CD integration, and Grafana Cloud for result analysis.

by Script Depot·92 views
$ tokrepo install k6-modern-load-testing-tool-using-go-javascript-4240522f
Config#05
Artillery — Modern Load Testing for HTTP, WebSocket & More

Node.js load testing toolkit with YAML scenarios covering HTTP, WebSocket, gRPC and Playwright, plus distributed runs on AWS Fargate.

by AI Open Source·89 views
$ tokrepo install artillery-modern-load-testing-http-websocket-more-729c7c2c
Config#06
Locust — Scalable Load Testing in Pure Python

Locust is an open-source load testing tool where you define user behavior in plain Python code. Distributed, scalable, and with a real-time web UI for monitoring. No DSL to learn — just write Python.

by AI Open Source·83 views
$ tokrepo install locust-scalable-load-testing-pure-python-42405496
FAQ

常见问题

整套全跑下来收费吗?

不收。每个工具都是开源宽松协议(MIT、Apache 2.0、Hoppscotch 自建是 AGPL)。k6 有付费的 Grafana Cloud k6 提供托管结果存储,但 OSS 二进制本地或 CI 里跑不限量。Artillery 有付费 pro 提供托管报表,核心 CLI 免费。Locust 和 Hurl 完全免费。

比 Postman 怎么样?

Postman 凭成熟 UX 仍然是首次 API 探索最顺的。开源 pack 在 collection / environment / 测试脚本上功能持平,外加两个大优势:文本文件 PR diff 干净、自建后密钥不出网。代价:协作 UX 没那么熟、没内置 API 监控(用 Workflow Orchestration 包补)。

Claude Code / Cursor 能用吗?

能。Claude Code 可以从 OpenAPI 规格生成 Bruno collection、Hurl 测试、k6 脚本 —— TokRepo 资产页给了 subagent prompt。常见用法:给 Claude 一份 openapi.yaml,让它生成覆盖每个端点的 tests/api/*.hurl,然后 CI 里跑 hurl --test tests/api/*.hurl。Cursor 用户在 .cursor/rules/ 下有等价规则。

Bruno 跟 Hoppscotch 区别?

Bruno 桌面优先、文件化 —— collection 以 .bru 文本存在你硬盘。适合已经用 git 当真相源的小团队。Hoppscotch 浏览器优先可选自建,实时协作模型更丰富 —— 适合产品和 QA 也要看请求结果的场景。多数团队选一个,但渐进迁移时可以共存。

k6 在 CI 跑的运维坑?

k6 即使阈值失败也输出 exit code 0,除非 --quiet=false 看 stderr —— 或者更好用 thresholdsabortOnFail: true。很多团队 CI 全绿但偷偷违反了 p99 SLO,因为信了 exit code。另:把 k6 --out pipe 成 JSON 当 CI artifact 存,方便对比历次运行。

更多主题包

12 个主题包 · 80+ 精选资产

回首页浏览全部精选合集

返回主题包总览