360 Secure SkillHub
360 安全技能中心

API Test Generator / API 测试生成

核心功能:支持pytest、Jest、Postman框架,自动生成含状态码、响应结构等断言的测试套件,内置Schema校验可快速发现API破坏性变更;Pro版支持Mock数据生成、实时监控API并自动更新测试。典型场景:API更新后排查回归问题、新成员通过测试学习API、集成到CI流水线验证代码变更。输入为OpenAPI 3.x规范文件,输出对应框架的测试套件。

kingaiwork
kingaiwork
热度 13.95
最近更新 2026-07-05 16:12:14
分类:开发依赖:代码执行 / 读写文件应用场景:代码生成 / API 集成 / 自动化脚本 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add api-test-gen
Metadata
name
api-test-gen
description
Generate API tests from OpenAPI spec with assertions. / 从 OpenAPI 规范生成带断言的 API 测试。
version
1.0.0
topics
["api","testing","automation","api测试","自动化"]
metadata
{"openclaw":{"requires":{"bins":["bash","curl"]},"emoji":"🧪","homepage":"https://kingai.work/","install":[]}}

🧪 API Test Generator / API 测试生成

Generate API tests from OpenAPI spec with assertions. / 从 OpenAPI 规范生成带断言的 API 测试。


Overview / 概览

• Generates complete test suites from any OpenAPI 3.x spec / 从任意 OpenAPI 3.x 规范一键生成完整测试套件,覆盖边缘情况与主流程 • Smart assertions for status codes, response body shape, and error handling / 智能断言引擎,自动校验状态码、响应结构及异常处理,让测试更可靠 • Supports multiple frameworks: pytest, Jest, Postman collection / 原生支持 pytest、Jest 与 Postman 集合,无缝融入现有工作流 • Built-in schema validation detects breaking API changes instantly / 内置 Schema 校验,秒级发现 API 破坏性变更,避免上线事故 • [Pro] Auto-generates realistic mock data using response schema / [Pro] 基于响应 Schema 自动生成逼真的 Mock 数据,解放手写样本的繁琐 • [Pro] Monitors your live API and updates tests when spec changes / [Pro] 实时监控线上 API,Spec 变动时自动更新测试,永不滞后

How It Works / 原理

# Step 1 — check environment
which bash curl && echo "Ready"

# Step 2 — run the tool
api-test-gen generate petstore.yaml --framework pytest --assertions all This generates a full pytest test suite for the Petstore API with every assertion type enabled. / 基于 Petstore 规范生成全套 pytest 测试,开启所有断言类型。 

# Step 3 — review output
echo "Done — check the generated output"

Example Scenarios / 示例场景

• You update an API endpoint and want to ensure existing clients still work. Use api-test-gen to regenerate tests and catch regressions. / 你更新了某个 API 端点,担心影响旧客户端,使用本工具重新生成测试,快速捕获回归问题。 • Your team needs to onboard a new developer to a complex API. Generate comprehensive tests as living documentation. / 团队新成员需要理解复杂 API,生成测试用例作为可执行文档,学习成本直降。 • You deploy a service with an OpenAPI spec and want CI to validate every change. Integrate generated tests into your pipeline. / 部署带 OpenAPI 规范的服务后,希望在 CI 中自动验证每次变更,只需将生成测试集成到流水线。

Plans / 版本

Capability Free Pro
Basics / 基础 ✅ ✅
Automation / 自动化 — ✅
AI / AI 功能 — ✅
Support Community Priority

• Unlock automated spec diffing and smart test updates 解锁自动 Spec 对比与智能测试更新,告别手动维护 • Get priority support and access to custom framework templates 获得专属技术支持与自定义框架模板,适配企业私有栈 • Remove rate limits for generating tests on large-scale specs (10,000+ endpoints) 移除大规模 Spec(万级端点)的生成速率限制,满足企业级需求\n\n

Need more power? Full version at https://kingai.work/

🖥️ RackNerd — 1GB KVM VPS / 高性能云服务器 https://my.racknerd.com/aff.php?aff=20179&pid=952

📈 moomoo — Stocks & Crypto Trading Up to $1,000 bonus / 最高 $1,000 奖励 https://j.moomoo.com/0CrlDz

Resources / 资源