← Back to Skills Marketplace
luiciferyi

Agent Testcase Generator

by LuiciferYi · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
99
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install agent-testcase-generator
Description
基于测试点生成标准化测试用例,含前置条件、测试步骤、预期结果、优先级。覆盖功能测试、API 测试、UI 自动化测试场景。 **⚠️ 强制要求:所有测试用例必须使用标准格式,见 [测试用例标准格式.md](测试用例标准格式.md)** Use when: 用户说"生成测试用例"、"写测试用例"、"测试用例设计"。...
README (SKILL.md)

Agent Testcase Generator

飞书文档写入位置

知识库: 7616288931050507220
节点: 效果评测/测试用例
wiki_node: FZXtwQd70iFCD3kifibcdBbpnId

⚠️ 强制要求:所有测试用例必须使用标准格式,包含14个必填字段!

When to Run

  • 测试点整理完成后
  • 用户提供功能模块或测试点清单
  • 需要编写详细测试用例

⚠️ 强制格式要求

必须包含的14个字段

  1. 用例标识(编号、名称、模块、需求、优先级、类型、设计人、日期)
  2. 测试目的
  3. 前置条件
  4. 测试数据(输入数据、预置数据)
  5. 执行步骤
  6. 预期结果
  7. 预期结果验证点
  8. 实际结果(执行时填写)
  9. 边界条件
  10. 异常场景
  11. 关联用例
  12. 自动化标记
  13. 数据准备
  14. 执行历史

格式规范

  • 使用 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 作为分隔线
  • 使用 📋 作为段落标记
  • 预期结果必须可验证、可量化
  • 必须包含验证点详细说明

禁止事项

  • ❌ 缺少任何必填字段
  • ❌ 预期结果模糊(如"正常显示")
  • ❌ 缺少验证点
  • ❌ 使用不可验证的描述

Workflow

  1. 接收测试点清单或功能模块
  2. 为每个测试点设计详细的测试步骤
  3. 区分功能测试用例和 API 测试用例
  4. 设计测试数据(输入数据、预期结果数据)
  5. 标记可自动化测试的用例
  6. 识别需要数据准备的用例
  7. 输出结构化测试用例(含14个必填字段)

测试用例设计规范

测试用例要素(14个必填)

要素 说明 示例
用例编号 唯一标识 TC-CREATE-001
用例名称 简明描述测试内容 创建智能体 - 正常流程
所属模块 功能模块 智能体管理
所属需求 关联需求ID REQ-001
优先级 P0/P1/P2 P0
用例类型 功能/接口/UI/性能/安全 功能
测试目的 为什么要测试 验证创建功能正确性
前置条件 执行前必须满足的条件 用户已登录、有权限
测试数据 具体输入数据 名称="测试助手"、模型="deepseek-chat"
执行步骤 可执行的操作步骤 1.进入页面 2.输入数据 3.点击按钮
预期结果 期望的结果(可验证) 1.提示成功 2.页面跳转 3.数据正确
验证点 详细验证点 检查点1、检查点2、检查点3
边界条件 边界值情况 最小值、最大值、空值
异常场景 相关异常 名称为空、重复、超长
自动化标记 是否可自动化 ✅ 可自动化 / ❌ 手工测试
数据准备 是否需要预置数据 需要预置用户账号

预期结果 vs 实际结果

预期结果(Expected Result)

  • 定义:执行测试步骤后,系统应该产生的正确行为或输出
  • 特点
    • 在测试用例设计时确定
    • 基于需求文档定义
    • 必须可验证、可量化
    • 作为判断测试通过/失败的标准
  • 示例
    • ✅ 页面显示"创建成功"提示
    • ✅ 数据库新增一条记录,name="测试助手"
    • ✅ API返回状态码201,body包含agent_id字段

实际结果(Actual Result)

  • 定义:执行测试步骤后,系统实际产生的行为或输出
  • 特点
    • 在测试执行时记录
    • 与预期结果对比判断通过/失败
    • 失败时需要详细记录,便于缺陷定位
  • 示例
    • ✅ 与预期一致:页面显示"创建成功"(测试通过)
    • ❌ 与预期不符:页面显示"系统错误"(测试失败)

结果对比示例

用例 预期结果 实际结果(通过) 实际结果(失败)
创建智能体 1.提示"创建成功"\x3Cbr>2.跳转到列表页 1.✅ 提示"创建成功"\x3Cbr>2.✅ 跳转到列表页 1.❌ 提示"系统错误"\x3Cbr>2.❌ 停留在创建页
名称为空校验 提示"名称不能为空" ✅ 提示"名称不能为空" ❌ 创建成功,无提示
API创建成功 返回201,包含agent_id ✅ 返回201,agent_id=12345 ❌ 返回500,body为空

输出格式

智能体平台测试用例(标准格式)

模块 1:智能体创建与配置

功能测试用例
【测试用例】
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 用例标识
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
用例编号:    TC-CREATE-001
用例名称:    创建智能体-正常流程
所属模块:    智能体管理
所属需求:    REQ-001
优先级:      P0
用例类型:    功能
设计人:      [设计人]
设计日期:    [YYYY-MM-DD]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 测试目的
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
验证智能体创建功能在正常输入下的正确性,确保用户能够成功创建智能体
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 前置条件
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 用户已登录系统
- 用户有创建智能体的权限
- 网络连接正常
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 测试数据
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
输入数据:
- 名称:测试助手
- 描述:这是一个测试智能体
- 模型:deepseek-chat

预置数据:
- 用户账号已存在
- 模型列表已加载
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 执行步骤
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. 进入智能体创建页面
2. 在名称输入框输入"测试助手"
3. 在描述输入框输入"这是一个测试智能体"
4. 在模型选择下拉框选择"deepseek-chat"
5. 点击"创建"按钮
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 预期结果
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 预期1:页面显示"创建成功"提示
- 预期2:页面自动跳转到智能体列表页
- 预期3:智能体列表中显示新创建的"测试助手"
- 预期4:数据库中新增一条智能体记录,name="测试助手"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 预期结果验证点
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
验证点1:页面提示验证
- 验证内容:页面显示"创建成功"
- 验证方式:页面元素检查
- 预期值:提示文本等于"创建成功"

验证点2:页面跳转验证
- 验证内容:页面URL变化
- 验证方式:URL检查
- 预期值:URL包含"/agents/list"

验证点3:列表数据验证
- 验证内容:列表显示新智能体
- 验证方式:列表元素检查
- 预期值:列表第一项name="测试助手"

验证点4:数据库验证
- 验证内容:数据库记录
- 验证方式:数据库查询
- 预期值:存在记录,name="测试助手", status="active"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 实际结果(执行时填写)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[执行时填写]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 边界条件
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 名称长度:1-50字符
- 描述长度:0-200字符
- 必填字段:名称、模型
- 选填字段:描述
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 异常场景
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 异常1:名称为空 → 预期:提示"名称不能为空"
- 异常2:名称重复 → 预期:提示"名称已存在"
- 异常3:名称超长 → 预期:提示"名称长度不能超过50"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 关联用例
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 前置用例:TC-LOGIN-001(用户登录)
- 后置用例:TC-CREATE-002(名称为空校验)
- 相关用例:TC-EDIT-001(编辑智能体)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 自动化标记
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
是否可自动化:  ✅ 是
自动化工具:    Playwright
自动化优先级:  P0
自动化状态:    已完成
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 数据准备
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- [ ] 测试账号准备
- [ ] 测试数据准备
- [ ] 预置数据准备
- [ ] 环境配置准备
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 执行历史
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
| 执行日期 | 执行人 | 执行结果 | 缺陷ID | 备注 |
|----------|--------|----------|--------|------|
| | | | | |
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 备注
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
无
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
API 测试用例
【测试用例】
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 用例标识
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
用例编号:    TC-API-001
用例名称:    创建智能体接口-正常请求
所属模块:    智能体管理-API
所属需求:    REQ-API-001
优先级:      P0
用例类型:    接口
设计人:      [设计人]
设计日期:    [YYYY-MM-DD]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 测试目的
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
验证创建智能体接口在正常请求参数下的正确性
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 前置条件
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 用户已登录,获取有效token
- 用户有创建智能体的权限
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 测试数据
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
请求方法:POST
请求URL:/api/v1/agent
请求头:
- Content-Type: application/json
- Authorization: Bearer {token}

请求体:
{
  "name": "测试助手",
  "description": "这是一个测试智能体",
  "model": "deepseek-chat"
}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 执行步骤
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. 构造请求参数
2. 发送POST请求
3. 接收响应结果
4. 验证响应状态码
5. 验证响应体内容
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 预期结果
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 预期1:HTTP状态码为201
- 预期2:响应体包含agent_id字段
- 预期3:响应体name字段等于"测试助手"
- 预期4:响应体status字段等于"active"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 预期结果验证点
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
验证点1:状态码验证
- 验证内容:HTTP状态码
- 验证方式:response.status_code
- 预期值:201

验证点2:响应体字段验证
- 验证内容:agent_id字段存在
- 验证方式:response.json()
- 预期值:agent_id不为空

验证点3:响应体数据验证
- 验证内容:name字段值
- 验证方式:response.json()
- 预期值:name="测试助手"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 实际结果(执行时填写)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[执行时填写]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 边界条件
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 请求体大小:最大10KB
- 字段长度:name最大50字符
- 必填字段:name、model
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 异常场景
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 异常1:缺少name字段 → 预期:返回400,错误信息"name不能为空"
- 异常2:无效token → 预期:返回401,错误信息"未授权"
- 异常3:重复名称 → 预期:返回409,错误信息"名称已存在"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 关联用例
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- 前置用例:TC-API-AUTH-001(获取token)
- 后置用例:TC-API-002(缺少必填参数)
- 相关用例:TC-API-GET-001(获取智能体列表)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 自动化标记
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
是否可自动化:  ✅ 是
自动化工具:    pytest + requests
自动化优先级:  P0
自动化状态:    已完成
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 数据准备
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- [ ] 测试账号准备
- [ ] 获取有效token
- [ ] 预置数据准备
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📋 执行历史
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
| 执行日期 | 执行人 | 执行结果 | 缺陷ID | 备注 |
|----------|--------|----------|--------|------|
| | | | |
Usage Guidance
This skill appears to do exactly what it says: generate testcases in a strict 14-field format and (if platform Feishu tooling is available) write them into a specific Feishu knowledge node. Before installing: 1) Confirm you are comfortable with the skill writing documents to the hard-coded Feishu knowledge base/node IDs — verify those IDs belong to your org or an intended repository. 2) Understand the platform provides Feishu credentials — the skill itself does not request them; ensure the platform's Feishu integration has the correct scope and that you approve writes to that location. 3) Test the skill on sample/non-sensitive inputs to verify output format and destination. 4) If you prefer control over where docs are stored, request a version that accepts a user-specified destination rather than hard-coded IDs.
Capability Analysis
Type: OpenClaw Skill Name: agent-testcase-generator Version: 1.0.0 The skill bundle is a legitimate tool for generating standardized software test cases and saving them to a Feishu (Lark) knowledge base. It defines a strict 14-field formatting requirement and utilizes standard Feishu integration tools (feishu_create_doc, feishu_update_doc) to manage documentation. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found; the hardcoded Feishu IDs in SKILL.md are consistent with the stated purpose of organizing test results in a specific workspace.
Capability Assessment
Purpose & Capability
The name/description (generate standardized test cases) matches the instructions and included template files. The skill also includes allowed Feishu doc tools and a specific Feishu knowledge base/node where output should be written — this is consistent with a skill that saves produced testcases to a docs system, but embedding fixed Feishu IDs means the skill targets a particular remote location rather than letting the user choose one.
Instruction Scope
SKILL.md stays on-topic: it defines a strict 14-field format, gives workflows and examples, and instructs producing structured testcases. It does not instruct reading arbitrary system files or exfiltrating secrets. It does include instructions to create/update/fetch Feishu docs at specific knowledge base/node IDs, which will cause remote writes when platform Feishu tooling is available.
Install Mechanism
Instruction-only skill with no install spec and no code files that execute — lowest-risk install profile. package.json only points to SKILL.md as main; nothing is downloaded or extracted.
Credentials
The skill declares no required environment variables or credentials, yet it lists feishu_* tools in allowed-tools and hard-codes a Feishu knowledge base/node. This is not necessarily malicious (the platform typically provides Feishu integration and credentials), but it is a capability/permission assumption: the skill will rely on the platform to supply Feishu access and will write to the specified destination. Confirm that the platform's Feishu integration is authorized and that writing to the hard-coded node is appropriate.
Persistence & Privilege
always is false and disable-model-invocation is false (normal). There is no indication the skill modifies other skills or system-wide configuration. It will persist generated testcases by writing docs to the Feishu node, which is consistent with its stated purpose.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-testcase-generator
  3. After installation, invoke the skill by name or use /agent-testcase-generator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of agent-testcase-generator. - Generates standardized test cases from test points, supporting functional, API, and UI automation scenarios. - Enforces strict 14-field case format (see 测试用例标准格式.md) with detailed requirements for each field. - Provides clear workflow and examples for both functional and API test cases. - Includes format rules, boundary/exception handling, automation markers, and procedures for Feishu documentation integration. - Strictly prohibits missing required fields or unverifiable results.
Metadata
Slug agent-testcase-generator
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Agent Testcase Generator?

基于测试点生成标准化测试用例,含前置条件、测试步骤、预期结果、优先级。覆盖功能测试、API 测试、UI 自动化测试场景。 **⚠️ 强制要求:所有测试用例必须使用标准格式,见 [测试用例标准格式.md](测试用例标准格式.md)** Use when: 用户说"生成测试用例"、"写测试用例"、"测试用例设计"。... It is an AI Agent Skill for Claude Code / OpenClaw, with 99 downloads so far.

How do I install Agent Testcase Generator?

Run "/install agent-testcase-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Agent Testcase Generator free?

Yes, Agent Testcase Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Agent Testcase Generator support?

Agent Testcase Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent Testcase Generator?

It is built and maintained by LuiciferYi (@luiciferyi); the current version is v1.0.0.

💬 Comments