Scripts2026年7月5日·1 分钟阅读

Keploy — Open-Source API Testing Platform with Auto-Generated Tests

Keploy captures real API traffic and replays it as tests with built-in mocks, eliminating the need to write test cases manually. It supports REST, GraphQL, and gRPC.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Keploy Overview
先审查命令
npx -y tokrepo@latest install a4b24de7-78af-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

Keploy is an open-source API testing platform that converts real API calls into test cases and data mocks automatically. Instead of writing tests manually, developers record live traffic and replay it deterministically. Keploy integrates at the OS level using eBPF, capturing network calls without requiring code changes.

What Keploy Does

  • Records API calls and database queries during normal application usage and converts them into replayable test suites
  • Generates data mocks for external dependencies such as databases, queues, and third-party APIs automatically
  • Uses eBPF-based instrumentation on Linux to intercept network traffic without requiring SDK integration
  • Supports deduplication of test cases to keep suites lean as traffic grows
  • Provides mutation testing to measure how effective the generated tests are at catching regressions

Architecture Overview

Keploy operates as a proxy layer that sits between the application and its external dependencies. On Linux it leverages eBPF hooks to capture syscalls for network I/O. Recorded sessions are stored as YAML test files alongside the project. During replay, Keploy injects the stored mocks and compares actual responses against recorded baselines, flagging any diff as a test failure. The CLI orchestrates recording and testing modes, and a Docker-based setup handles containerized applications.

Self-Hosting & Configuration

  • Install via a single shell script or use the official Docker image for containerized setups
  • Runs as a sidecar or proxy alongside your application with no code changes required
  • Configuration is done through CLI flags and YAML config files in the project root
  • Supports integration with CI/CD pipelines via GitHub Actions, GitLab CI, and Jenkins
  • Test cases and mocks are stored as plain YAML files, making them version-controllable

Key Features

  • Zero-code test generation from live or staged API traffic
  • Built-in noise filtering to handle timestamps, random IDs, and other non-deterministic fields
  • Native support for REST, GraphQL, and gRPC protocols
  • Mutation testing capabilities to evaluate the quality of generated test suites
  • Contract testing mode that validates API compatibility between services

Comparison with Similar Tools

  • Postman — Requires manual test creation and scripting; Keploy auto-generates tests from real traffic
  • Pact — Focused on contract testing with explicit consumer-provider definitions; Keploy captures contracts implicitly
  • WireMock — Provides mock servers but requires manual stub configuration; Keploy auto-generates mocks
  • Hoverfly — Captures and simulates HTTP traffic but lacks test assertion generation
  • Selenium/Playwright — UI-level testing frameworks; Keploy operates at the API layer for faster feedback loops

FAQ

Q: Does Keploy require changes to my application code? A: No. Keploy uses eBPF on Linux to capture traffic at the OS level. For macOS and Docker setups, it runs as a network proxy.

Q: What languages and frameworks does Keploy support? A: Keploy is language-agnostic since it operates at the network layer. It works with Go, Java, Python, Node.js, and any framework that makes network calls.

Q: Can I use Keploy in CI/CD pipelines? A: Yes. Keploy provides CLI commands for test replay that integrate with any CI system. Pre-built GitHub Actions are available.

Q: How does Keploy handle non-deterministic data like timestamps? A: Keploy includes noise detection that automatically identifies and filters non-deterministic fields such as timestamps, UUIDs, and session tokens.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产