← 返回 Skills 市场
zhanghengyi1986-afk

Test Case Generator

作者 zhanghengyi1986-afk · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
81
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install test-case-gen
功能描述
Generate test cases from requirements, user stories, PRDs, or API docs. Output structured test cases in markdown tables or export to CSV/JSON. Supports equiv...
使用说明 (SKILL.md)

Test Case Generator

Generate structured, thorough test cases from various input sources.

When to Use

USE this skill when:

  • User provides requirements/PRD/user story and needs test cases
  • "帮我写测试用例" / "根据需求生成用例"
  • Analyzing boundary values or equivalence classes
  • Creating test matrices or decision tables
  • Reviewing existing test coverage for gaps

DON'T use this skill when:

  • Running or executing tests → use api-tester or manual execution
  • Writing automation scripts → use api-tester or coding tools
  • Tracking bugs → use project management tools

Workflow

Step 1: Analyze Input

Read the provided input (requirements doc, user story, API spec, or verbal description). Identify:

  • Functional points: What the system should do
  • Input parameters: All inputs with data types and constraints
  • Business rules: Conditional logic, validations, permissions
  • Integration points: External systems, APIs, databases
  • Non-functional aspects: Performance, security, usability

Step 2: Apply Test Design Techniques

Based on the analysis, apply appropriate techniques:

Technique When to Apply
Equivalence Partitioning Multiple input values with similar behavior
Boundary Value Analysis Numeric ranges, string lengths, date ranges
Decision Table Complex business rules with multiple conditions
State Transition Workflows with status changes (order, ticket, etc.)
Error Guessing Based on common defect patterns
Pairwise/Combinatorial Multiple parameters with interactions

Step 3: Generate Test Cases

Output format (default markdown table):

| ID | Module | Priority | Precondition | Steps | Input Data | Expected Result | Type |
|----|--------|----------|--------------|-------|------------|-----------------|------|
| TC001 | Login | P0 | User registered | 1. Open login page 2. Enter credentials 3. Click login | user: admin, pass: Admin@123 | Login success, redirect to dashboard | Positive |
| TC002 | Login | P0 | User registered | 1. Open login page 2. Enter wrong password 3. Click login | user: admin, pass: wrong | Error: "Invalid credentials" | Negative |

Priority definitions:

  • P0: Core functionality, blocks release if failed
  • P1: Important features, should fix before release
  • P2: Minor features, can defer
  • P3: Edge cases, nice to have

Type categories:

  • Positive / Negative / Boundary / Exception / Security / Performance

Step 4: Coverage Analysis

After generating, provide a coverage summary:

📊 Test Coverage Summary
- Total cases: 25
- By priority: P0(8) P1(10) P2(5) P3(2)
- By type: Positive(10) Negative(8) Boundary(4) Security(2) Performance(1)
- Estimated gaps: [list any uncovered areas]

Export Options

When user requests export:

# Save as CSV — write to workspace
# ~/.openclaw/workspace/output/test_cases.csv

# Save as JSON (for TestLink/禅道 import)
# ~/.openclaw/workspace/output/test_cases.json

禅道 CSV Import Format

所属模块,用例标题,前置条件,步骤,预期,优先级,用例类型,关键词
/登录模块,正常登录验证,用户已注册,1.打开登录页 2.输入正确账号密码 3.点击登录,登录成功跳转首页,1,功能测试,登录;正向

TestLink XML Format

\x3C?xml version="1.0" encoding="UTF-8"?>
\x3Ctestcases>
  \x3Ctestcase name="正常登录验证">
    \x3Csummary>验证使用正确账号密码能成功登录\x3C/summary>
    \x3Cpreconditions>用户已注册\x3C/preconditions>
    \x3Csteps>
      \x3Cstep>
        \x3Cstep_number>1\x3C/step_number>
        \x3Cactions>打开登录页,输入正确账号密码,点击登录\x3C/actions>
        \x3Cexpectedresults>登录成功,跳转首页\x3C/expectedresults>
      \x3C/step>
    \x3C/steps>
    \x3Cimportance>2\x3C/importance>
    \x3Cexecution_type>1\x3C/execution_type>
  \x3C/testcase>
\x3C/testcases>

Tips for Better Test Cases

  • Always include at least one boundary value test per numeric input
  • For every positive case, create at least one corresponding negative case
  • Don't forget null/empty/whitespace inputs
  • Consider concurrent access scenarios for multi-user features
  • Include data format validation (email, phone, ID card, etc.)
  • Test with special characters: \x3Cscript>alert(1)\x3C/script>, ' OR 1=1--, emoji 🔍

Pairwise / Combinatorial Testing

When multiple input parameters interact, use pairwise to reduce combinations:

参数A: [a1, a2, a3]
参数B: [b1, b2]
参数C: [c1, c2, c3]

全组合: 3×2×3 = 18 条
Pairwise: ~9 条(覆盖所有两两组合)

示例输出:

# 参数A 参数B 参数C
1 a1 b1 c1
2 a1 b2 c2
3 a2 b1 c3
4 a2 b2 c1
5 a3 b1 c2
6 a3 b2 c3
...

适用场景:浏览器兼容性(浏览器×系统×分辨率)、表单多字段组合、配置项测试。

State Transition Testing

For workflow/status-driven features, map out state transitions:

[草稿] --提交--> [待审核] --通过--> [已发布]
   |                  |--驳回--> [已驳回] --修改--> [草稿]
   |--删除--> [已删除]

Generate test cases covering:

  • 每个状态: 至少访问一次
  • 每个转换: 至少触发一次
  • 非法转换: 验证不允许的状态变更(如 已发布→草稿)
  • 并发转换: 两人同时审核同一条记录
安全使用建议
This skill is coherent and appears to do only what it says: generate and optionally export test cases. Before using it: (1) avoid pasting secrets or real credentials into the requirements you provide (the skill will include provided input in outputs), (2) confirm you are okay with exported files being written under ~/.openclaw/workspace/output/ if you request CSV/JSON exports, and (3) review generated test cases before importing them into your test management tools. No additional credentials or installs are required.
功能分析
Type: OpenClaw Skill Name: test-case-gen Version: 1.0.0 The skill bundle is a legitimate tool designed to guide an AI agent in generating structured test cases from requirements or API documentation. It provides comprehensive instructions on test design techniques (e.g., boundary value analysis, state transitions) and includes templates for exporting results to CSV or XML. No malicious logic, data exfiltration, or harmful prompt injections were identified in SKILL.md or _meta.json.
能力评估
Purpose & Capability
Name and description (generate structured test cases from requirements/specs) align with the SKILL.md instructions. All described features (BVA, equivalence, decision tables, exports) are documented and consistent with the stated purpose.
Instruction Scope
SKILL.md instructs the agent to read only user-provided inputs (requirements, PRDs, API specs) and to produce structured test cases. It includes export examples that write to a workspace path (~/.openclaw/workspace/output/...). This is expected for an export function, but users should be aware the skill may write files to the agent workspace if asked to export.
Install Mechanism
No install spec and no code files are present (instruction-only). Nothing will be downloaded or written to disk by an installer step — low risk.
Credentials
The skill requires no environment variables, no credentials, and no config paths. There is no disproportionate request for secrets or unrelated service access.
Persistence & Privilege
always is false and the skill does not request persistent or elevated privileges. It does not modify other skills or system-wide settings in the provided instructions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install test-case-gen
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /test-case-gen 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: test case generation from requirements, boundary analysis, pairwise, state transition, CSV/JSON export
元数据
Slug test-case-gen
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Test Case Generator 是什么?

Generate test cases from requirements, user stories, PRDs, or API docs. Output structured test cases in markdown tables or export to CSV/JSON. Supports equiv... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 81 次。

如何安装 Test Case Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install test-case-gen」即可一键安装,无需额外配置。

Test Case Generator 是免费的吗?

是的,Test Case Generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Test Case Generator 支持哪些平台?

Test Case Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Test Case Generator?

由 zhanghengyi1986-afk(@zhanghengyi1986-afk)开发并维护,当前版本 v1.0.0。

💬 留言讨论