Api Scenario Automation logo

Api Scenario Automation

Community
xiaoce-xiaoce
api-scenario-automation

根据需求文档、测试用例、OpenAPI、Postman、Apipost、Swagger、Markdown 接口文档、后端文档或后端路由生成场景化接口自动化。适用于生成接口流程编排、scenarios.yaml/scenarios.json 场景文件、unittest/pytest 兼容的接口自动化测试,以及带数据依赖的端到端接口测试;不用于生成单元测试。

Overview

Publisherxiaoce-xiaoce
Repositorytesting-skills-xiaoce
Skill nameapi-scenario-automation
Stars
40
Forks
4
Bundled files
6
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by xiaoce-xiaoce on GitHub. Read the source before you install it.

Installation

Install the Api Scenario Automation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/xiaoce-xiaoce/testing-skills-xiaoce/tree/main/api-scenario-automation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/xiaoce-xiaoce/testing-skills-xiaoce.git /tmp/testing-skills-xiaoce
mkdir -p .claude/skills
cp -r /tmp/testing-skills-xiaoce/api-scenario-automation .claude/skills/api-scenario-automation
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Api Scenario Automation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Api Scenario Automation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Api Scenario Automation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

场景化接口自动化

使用本 skill 将接口资料和测试用例转换成场景化接口自动化。目标不是生成单接口冒烟用例,而是生成可执行的业务流程:包含请求顺序、变量提取、跨步骤数据依赖、业务断言和清晰的失败反馈。

工作流程

  1. 收集源材料:
    • 接口资料:OpenAPI、Swagger、Postman 集合、Apipost 导出、Markdown 接口文档、后端路由文件。
    • 可选上游测试用例,例如 test-case-xmind 生成的 cases.json。
    • 环境信息:base_url、测试账号、鉴权方式、必要测试数据、数据清理要求。
  2. 编写场景 DSL 前,阅读 references/scenario_schema.md。
  3. 导出测试代码前,阅读 references/pytest_export.md。
  4. 如果接口资料是 Markdown,可以先运行 scripts/extract_api_inventory.py 提取接口清单。
  5. 生成 scenarios.yaml。除非用户明确要求其他格式,否则保持 JSON 兼容 YAML。
  6. 运行 scripts/validate_scenarios.py scenarios.yaml 校验场景文件,并修复所有错误。
  7. 运行 scripts/export_pytest.py scenarios.yaml --output <项目目录>/api-automation 导出接口自动化测试代码。
  8. 如果目标应用可以在本地运行,执行生成的测试套件;如果无法运行,交付生成文件并说明未执行的原因。

场景设计规则

  • 优先生成 3-8 条有价值的业务场景,而不是大量浅层接口检查。
  • 使用 extract 和 {{ variable }} 模板串联步骤之间的数据。
  • 同时断言传输结果和业务结果:
    • HTTP 状态码。
    • 响应字段。
    • 创建后的资源能被查询。
    • 数量、状态、归属关系或业务流转符合预期。
    • 禁止访问路径返回正确失败结果。
  • 在有价值的地方加入反向场景:缺少必填字段、非法 ID、错误鉴权、过期状态、重复提交、可注入的服务错误。
  • 保持测试确定性。避免真实支付、真实邮件、真实 AI 调用或不可逆的生产操作。
  • 如果没有清理接口,生成唯一测试数据,并避免依赖持久化全局状态。

输出结构

默认输出目录:

text
api-automation/
├── scenarios.yaml
├── tests/
│   └── test_api_scenarios.py
└── README.generated.md

scenarios.yaml 是接口自动化的源文件。生成的测试文件会内嵌场景定义,因此运行时不需要额外 YAML 解析依赖。导出的测试基于 unittest,也可以被 pytest 收集执行。

脚本

可在任意工作目录运行:

bash
python3 <skill>/scripts/extract_api_inventory.py docs/接口文档.md --output api-inventory.json
python3 <skill>/scripts/validate_scenarios.py scenarios.yaml
python3 <skill>/scripts/export_pytest.py scenarios.yaml --output api-automation

脚本只使用 Python 标准库。生成的接口自动化测试也只使用 Python 标准库,可以通过 python3 -m unittest 运行;如果项目安装了 pytest,也可以被 pytest 收集执行。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Api Scenario Automation AI skill do?

根据需求文档、测试用例、OpenAPI、Postman、Apipost、Swagger、Markdown 接口文档、后端文档或后端路由生成场景化接口自动化。适用于生成接口流程编排、scenarios.yaml/scenarios.json 场景文件、unittest/pytest 兼容的接口自动化测试,以及带数据依赖的端到端接口测试;不用于生成单元测试。

Why use Api Scenario Automation on TypingMind?

Because you install it once and use it with any model. Api Scenario Automation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Api Scenario Automation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/xiaoce-xiaoce/testing-skills-xiaoce/tree/main/api-scenario-automation. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Api Scenario Automation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Api Scenario Automation?

As many as you like. As long as a model supports skills, you can use Api Scenario Automation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Api Scenario Automation AI skill free?

It is published on GitHub by xiaoce-xiaoce. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇