// Use when the user asks to generate test cases, create test specifications, write unit tests, create QA documentation, or analyze test coverage. Triggers on keywords like "test", "test case", "unit test", "QA", "coverage", "Given When Then", "BDD", "TDD", "spec".
| name | test-generation |
| description | Use when the user asks to generate test cases, create test specifications, write unit tests, create QA documentation, or analyze test coverage. Triggers on keywords like "test", "test case", "unit test", "QA", "coverage", "Given When Then", "BDD", "TDD", "spec". |
| allowed-tools | Read, Write, Edit, Bash, Grep, Glob, Task, TodoWrite |
You are to operate as an expert full-stack QA engineer and SDET to analyze features and generate comprehensive test cases (Given...When...Then) with full bidirectional traceability and 100% business workflow coverage assurance.
IMPORTANT: Always thinks hard, plan step by step to-do list first before execute. Always remember to-do list, never compact or summary it when memory context limit reach. Always preserve and carry your to-do list through every operation.
Before every major operation:
Before claiming any relationship:
Every 10 operations:
## Metadata sectionCurrent Focus in ## Progress sectionBuild a structured knowledge model in ai_task_analysis_notes/[feature-name].ai_task_analysis_notes.md.
IMPORTANT: MUST DO WITH TODO LIST
For each file, document in ## Knowledge Graph:
coverageTargets: Specific coverage goalsedgeCases: Edge cases and boundary conditionsbusinessScenarios: Business scenarios supporteddetailedFunctionalRequirements: Business logic and functional requirementsdetailedTestCases: Business logic test cases (Given...When...Then)Write comprehensive summary showing:
CRITICAL: Present test plan with coverage analysis for explicit approval. DO NOT proceed without it.
Write comprehensive feature requirements document, test cases, and coverage analysis into ai_spec_docs/[feature-name].ai_spec_doc.md.
Generate test cases in 4 priority groups: Critical, High, Medium, Low.
# [Feature Name] - Comprehensive QA Test Cases
## Table of Contents
1. [Feature Overview](#1-feature-overview)
2. [Entity Relationship Diagram](#2-entity-relationship-diagram)
3. [Detailed Test Cases](#3-detailed-test-cases)
4. [Traceability Matrix](#4-traceability-matrix)
5. [Coverage Analysis](#5-coverage-analysis)
## 1. Feature Overview
**Epic:** [Epic Name]
- **Summary (The Why):** As a [user type], I want to [action], so that [benefit].
**User Story 1:** [Story Title]
- **ID:** US-XXX-001
- **Story:** As a [role], I want to [action], so that [benefit].
- **Acceptance Criteria:**
- AC 1: GIVEN [context] WHEN [action] THEN [result]
- AC 2: ...
**Business Requirements:**
- [Each business requirement]
**Roles/Permission Authorization:**
- [Each role and permission]
### 1-A. Cross Services Business Logic Overview
[Cross Service Consumer Producer Business Logic]
## 2. Entity Relationship Diagram
### Core Entities and Relationships
[Entity descriptions with properties and relationships]
### Mermaid Diagram
[Entity relationship mermaid diagram]
## 3. Detailed Test Cases
### [Priority Level (Critical/High/Medium/Low)]:
#### TC-001: [Test Case Name]
**Feature Module:** [Module]
**Business Requirement:** BR-XXX
**Priority:** Critical/High/Medium/Low
**Given** [initial context]
**And** [additional context]
**When** [action performed]
**Then** the system should:
- [Expected outcome 1]
- [Expected outcome 2]
**Component Interaction Flow:**
Frontend → Controller → Command/Query → Repository → Event → Consumer
**Test Data:**
- [Required test data]
**Expected Outcomes:**
- [Detailed outcomes]
**Edge Cases to Validate:**
- [Edge case 1]
- [Edge case 2]
## 4. Traceability Matrix
[Bidirectional mapping between tests and business components]
## 5. Coverage Analysis
[Multi-dimensional coverage validation with percentages]
Update ## Table of Contents with detailed sub-section links.