展示HN:Tusk Drift – 开源的API测试自动化工具
Show HN: Tusk Drift – Open-source tool for automating API tests

原始链接: https://github.com/Use-Tusk/drift-node-sdk

## Tusk Drift SDK:快速且确定性的 API 测试 Tusk Drift SDK (Node.js) 通过捕获和重放真实的 API 调用来简化 API 测试。这使得快速、确定性的回归测试成为可能,而无需实时环境的副作用。 自动记录 API 交互,然后使用 Tusk CLI 重放它们,从而快速识别回归。Drift 在重放期间拦截外发请求,使用记录的数据以获得一致的结果。 目前,Tusk Drift 支持广泛的流行包,包括 HTTP/HTTPS、gRPC、PostgreSQL、Firestore、Redis、GraphQL、Prisma 和 JWT 库(有关特定版本,请参阅文档)。欢迎通过 GitHub issue 提出对更多包的支持。 入门涉及安装 Tusk CLI、配置 Tusk、安装 `@use-tusk/drift-node-sdk` 包以及为您的服务初始化 SDK。全面的指南和文档在线提供,并通过 Slack 提供社区支持。

## Tusk Drift:自动化 API 测试 Tusk Drift 是一款新的开源工具,旨在简化和改进 API 测试。它的工作原理是**记录实时 API 流量并将其重放为测试**,并使用模拟响应自动检测与预期行为的偏差。 与传统的模拟不同,Drift 从*实际*用户交互中学习,创建健壮且无副作用的测试,运行速度快(<100 毫秒)。它本质上是“API 的单元测试”,类似于 OpenTelemetry 对 Node 服务进行工具化处理。 配套的云平台可自动更新测试套件,与 CI/CD 管道集成,甚至可以使用 Claude Sonnet 4.5 等模型建议代码修复。 目前,Drift 支持 Node 后端,并提供有限的工具化包,Python SDK 正在开发中。用户应注意潜在的吞吐量开销(1-2%)以及配置 PII 删减的必要性。 项目和演示仓库可在 GitHub 上找到:[https://github.com/use-tusk/drift-node-demo](https://github.com/use-tusk/drift-node-demo)
相关文章

原文

Tusk Drift Banner

npm version License: Apache 2.0 GitHub last commit Tusk X account Tusk Community Slack

The Node.js Tusk Drift SDK enables fast and deterministic API testing by capturing and replaying API calls made to/from your service. Automatically record real-world API calls, then replay them as tests using the Tusk CLI to find regressions. During replay, all outbound requests are intercepted with recorded data to ensure consistent behavior without side-effects.

For comprehensive guides and API reference, visit our full documentation.

Tusk Drift currently supports the following packages and versions:

If you're using packages or versions not listed above, please create an issue with the package + version you'd like an instrumentation for.

First, install and configure the Tusk Drift CLI by following our CLI installation guide. The CLI helps set up your Tusk configuration file and replays tests.

The wizard will eventually direct you back here when it's time to set up the SDK.

After completing the CLI wizard, install the SDK:

npm install @use-tusk/drift-node-sdk

Step 3: Initialize the SDK for your service

Refer to our initialization guide to set up the SDK for your service.

Step 4: Run Your First Test

Follow along our quick start guide to record and replay your first test!

Having issues?

Join our open source community on Slack.

We appreciate feedback and contributions. See CONTRIBUTING.md.

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

联系我们 contact @ memedata.com