SuperAPI AI Directory

game-test-case-generator

Testing & quality

View repository

Updated 10-15 16:45

About this skill

Game Test Case Generator

Core Capabilities

Convert game requirement documents (xls/csv/text/images) into standardized test cases, supporting two generation modes:

  • Full Mode: Standardized test cases including preconditions, detailed steps, and expected results
  • Quick Mode: A concise list of test points, suitable for quick review

Output format: Markdown (importable into Xmind) or Excel

Usage Workflow

Step 1: Confirm Generation Mode

Ask the user to choose a mode:

请选择测试用例生成模式:
1. 完整模式 - 生成规范的测试用例集(含编号、前置条件、操作步骤、预期结果)
2. 快速模式 - 仅生成测试点列表(快速评审用)

Default: Full Mode


### 第二步:解析需求材料

**支持的输入格式**:
- xls/xlsx/csv 文件
- 文本描述
- 原型图片(识别UI元素、交互流程)
- 混合格式(文本+图片)

**解析策略**:
1. **结构化文档**(xls/csv):
   - 识别列:功能模块、需求描述、UI说明、验收标准等
   - 提取关键信息:玩法流程、数值配置、交互逻辑
   
2. **文本描述**:
   - 拆解功能模块(如登录、战斗、社交、付费)
   - 提取核心玩法(如抽卡、副本、任务系统)
   - 识别交互点(按钮点击、手势操作、弹窗逻辑)

3. **原型图片**:
   - 识别界面元素:按钮位置、文本框、弹窗样式
   - 理解流程逻辑:任务引导、页面跳转、状态变化

**输出需求映射表**:
```markdown
| 需求ID | 需求描述 | 来源 | 测试点数量 | 备注 |
|--------|----------|------|-----------|------|
| REQ-001 | 用户登录 | 需求文档第3行 | 8 | 含第三方登录 |

Step 3: Generate Test Cases

Full Mode Workflow

1. Module Classification Organize by game functional modules:

  • Account system (login/registration/account security)
  • Core gameplay (combat/progression/social)
  • System functions (shop/inventory/quests)
  • Performance/compatibility

2. Scenario Coverage Principles Each functional point must cover at least 3 types of scenarios:

  • Normal scenario: Standard process execution
  • Boundary scenario: Extreme value testing (level cap, maximum item quantity, long character input)
  • Exception scenario: Error handling (network disconnection, illegal input, concurrent operations)

3. Test Case Structure(Use template: templates/full-template.md)

## 用例编号:模块-功能编号-场景类型

**测试类型**:功能/性能/兼容性/安全
**优先级**:高/中/低
**前置条件**:
- 条件1
- 条件2

**操作步骤**:
1. 具体操作(精确到"点击XX按钮")
2. 具体操作(精确到"输入XX内容")

**预期结果**:
- 可量化的验证点
- 无歧义的判断标准

**异常分支**:
- 异常情况描述及预期处理

4. Test Case Numbering Rules

  • Format:模块缩写-功能编号-场景类型
  • Example:LOG-001-N(Login module - 1st function - normal scenario)
  • Scenario type: N(normal)/B(boundary)/E(exception)

5. Priority Definitions

  • High: Core processes, payment segments, account security
  • Medium: Commonly used functions, secondary gameplay
  • Low: Optimization features, edge scenarios

Quick Mode Workflow

Use Template:templates/quick-template.md

Output Structure:

# 模块名称

## 核心测试点
- [ ] 测试点描述(含验证标准)
- [ ] 测试点描述(含验证标准)

## 边界场景
- [ ] 测试点描述
- [ ] 测试点描述

## 异常场景
- [ ] 测试点描述
- [ ] 测试点描述

## 待确认项
- ❓ 模糊需求描述 → 推荐方案

Step 4: Quality Check

Mandatory Check Items:

  • Requirement coverage: all requirement points have corresponding test cases
  • Scenario completeness: normal/boundary/exception scenarios are all present
  • Clarity of expression: no vague words such as "possibly" or "probably"
  • Executability: steps are specific and results are verifiable
  • Cross-module interaction: scenarios involving multiple modules are covered

Handling Items to Be Confirmed: Annotate ambiguous/conflicting/missing requirements:

## 待确认项

### 问题1:登录方式未明确
**描述**:需求未说明是否支持第三方登录
**方案A**:仅支持账号密码登录
**方案B**:支持微信/QQ第三方登录
**推荐**:方案B(符合行业惯例)
**影响用例**:LOG-003、LOG-004

Step 5: Format Conversion

Markdown Output(default):

  • Can be used directly for document viewing
  • Supports import into Xmind (script:scripts/convert_to_xmind.py)
  • Hierarchical structure: module → function point → test case

Excel Output(optional): Use script:scripts/convert_to_excel.py

Excel table structure:

Test Case Number Module Function Point Test Type Priority Preconditions Operation Steps Expected Results Exception Branches

Conversion Command Examples:

# 转换为Excel
python scripts/convert_to_excel.py output.md -o 测试用例集.xlsx

# 转换为Xmind格式
python scripts/convert_to_xmind.py output.md -o 测试用例.xmind

Output Specifications

Document Structure

Full Mode Output:

# [游戏名称] 测试用例集
**版本**:v1.0
**测试模块**:XXX模块
**生成时间**:2026-01-27

## 📋 需求映射表
[需求点 → 用例编号 → 覆盖场景]

## 📦 测试用例集

### 模块1:账号系统
#### 功能1.1:用户登录
##### 用例 LOG-001-N:正常登录流程
[完整用例内容]

##### 用例 LOG-001-B:边界测试 - 密码长度上限
[完整用例内容]

##### 用例 LOG-001-E:异常测试 - 网络中断
[完整用例内容]

## ❓ 待确认项
[问题描述 + 方案对比 + 推荐方案]

## 📊 统计信息
- 总用例数:XX
- 高优先级:XX
- 中优先级:XX
- 低优先级:XX
- 待确认项:XX

Quick Mode Output:

# [游戏名称] 测试点清单
**版本**:v1.0
**生成时间**:2026-01-27

## 模块1:账号系统

### 用户登录
- [ ] 正确账号密码登录成功,进入游戏主界面
- [ ] 错误密码提示"密码错误",不允许登录
- [ ] 密码输入32位(上限)正常登录
- [ ] 网络断开提示"网络连接失败"
- [ ] 连续5次密码错误触发账号锁定

### 第三方登录
- [ ] 微信授权登录成功,自动绑定游戏账号
- [ ] 取消微信授权返回登录页,不创建账号
...

## ❓ 待确认项
- 登录方式是否包含手机验证码登录?
- 账号锁定时长未明确(建议30分钟)

Special Scenario Handling

Requirement Conflicts

Identification Criteria: Contradictory descriptions in different chapters of the requirements document Handling Method:

## ⚠️ 需求冲突

**冲突点**:用户等级上限
- 需求第3章描述:等级上限100级
- 原型图显示:等级上限150级

**协调方案**:
- 方案A:采用100级(文档为准)
- 方案B:采用150级(原型为准)

**推荐**:方案A,并补充说明:若后续版本提升上限,需修改UI显示范围

**临时处理**:生成两套边界测试用例(100级和150级)

Image Information Extraction

When requirements include prototype diagrams:

  1. Identify UI Elements: Position and style of buttons, text boxes, and icons
  2. Extract Interaction Logic: Click flow, page navigation, state changes
  3. Generate UI Test Points:
### UI测试点(基于原型图)
- [ ] "立即登录"按钮位于屏幕下方,蓝色背景白色文字
- [ ] 账号输入框显示提示文字"请输入账号",字体灰色
- [ ] 密码输入框内容显示为圆点,支持明文/密文切换图标
- [ ] 忘记密码链接位于密码框右侧,字体12px蓝色

Performance Metrics

If the requirements involve performance requirements:

### 性能测试用例 PERF-001-N
**测试类型**:性能
**优先级**:高

**测试场景**:100人同时在线战斗
**性能指标**:
- 服务器响应时间 ≤ 200ms
- 客户端帧率 ≥ 30fps
- 内存占用 ≤ 512MB

**测试步骤**:
1. 启动性能监控工具
2. 模拟100个玩家同时进入战斗场景
3. 持续测试5分钟
4. 记录性能数据

**预期结果**:
- 所有指标均在阈值范围内
- 无崩溃、无卡顿

Advanced Techniques

Test Case Reuse

For similar functions (such as the usage logic of different items), use parameterization:

### 用例模板:道具使用 ITEM-USE-N
**参数**:道具类型、使用效果、冷却时间

**测试数据**:
| 道具类型 | 使用效果 | 冷却时间 |
|---------|---------|---------|
| 生命药水 | 恢复50%HP | 30秒 |
| 魔法药水 | 恢复50%MP | 30秒 |
| 复活石 | 原地复活 | 无 |

Automation Tagging

Add tags to test cases that can be automated:

**自动化程度**:🤖 可自动化 / ⚠️ 半自动化 / 👤 纯手工

用例 LOG-001-N:正常登录流程 🤖
用例 COMBAT-005-N:战斗特效表现 👤

Precautions

  1. Unified Terminology: Use consistent terminology throughout (e.g., do not mix "player" with "user")
  2. Specific Steps: Avoid "check that the function works normally"; instead use "check that the HP value decreases from 100 to 50"
  3. Prohibit Vague Words: Do not use words such as "possibly", "probably", "basically", etc.
  4. Cross-Module Test Cases: List scenarios involving multi-module interactions separately
  5. Version Tagging: If requirements are iterated by version, indicate the version to which the test case belongs

Quality Standards

Qualification Standards:

  • ✅ Requirement coverage ≥ 95%
  • ✅ At least 3 scenarios per function point (normal/boundary/exception)
  • ✅ Priority of core process test cases is "High"
  • ✅ No vague expressions
  • ✅ All items to be confirmed are marked

Auxiliary Resources