docs: enhance test task generation documentation with existing test infrastructure and framework usage

This commit is contained in:
catlog22
2025-11-24 21:14:32 +08:00
parent f798dd4172
commit 3acf6fcba8
2 changed files with 56 additions and 3 deletions

View File

@@ -236,6 +236,25 @@ Generate individual `.task/IMPL-*.json` files with the following structure:
- `agent`: Assigned agent for execution
- `execution_group`: Parallelization group ID (tasks with same ID can run concurrently) or `null` for sequential tasks
**Test Task Extensions** (for type="test-gen" or type="test-fix"):
```json
{
"meta": {
"type": "test-gen|test-fix",
"agent": "@code-developer|@test-fix-agent",
"test_framework": "jest|vitest|pytest|junit|mocha",
"coverage_target": "80%",
"use_codex": true|false
}
}
```
**Test-Specific Fields**:
- `test_framework`: Existing test framework from project (required for test tasks)
- `coverage_target`: Target code coverage percentage (optional)
- `use_codex`: Whether to use Codex for automated fixes in test-fix tasks (optional, default: false)
#### Context Object
```json
@@ -307,6 +326,32 @@ Generate individual `.task/IMPL-*.json` files with the following structure:
}
```
**Test Task Extensions** (for type="test-gen" or type="test-fix"):
```json
{
"flow_control": {
"pre_analysis": [...],
"implementation_approach": [...],
"target_files": [...],
"reusable_test_tools": [
"tests/helpers/testUtils.ts",
"tests/fixtures/mockData.ts",
"tests/setup/testSetup.ts"
],
"test_commands": {
"run_tests": "npm test",
"run_coverage": "npm test -- --coverage",
"run_specific": "npm test -- {test_file}"
}
}
}
```
**Test-Specific Fields**:
- `reusable_test_tools`: List of existing test utility files to reuse (helpers, fixtures, mocks)
- `test_commands`: Test execution commands from project config (package.json, pytest.ini)
##### Pre-Analysis Patterns
**Dynamic Step Selection Guidelines**:

View File

@@ -20,6 +20,7 @@ Generate test planning documents (IMPL_PLAN.md, test task JSONs, TODO_LIST.md) u
- **Memory-First**: Reuse loaded documents from conversation memory
- **MCP-Enhanced**: Use MCP tools for test pattern research and analysis
- **Path Clarity**: All `focus_paths` prefer absolute paths (e.g., `D:\\project\\src\\module`), or clear relative paths from project root
- **Leverage Existing Test Infrastructure**: Prioritize using established testing frameworks and tools present in the project
## Test-Specific Execution Modes
@@ -79,7 +80,9 @@ Generate test planning documents (IMPL_PLAN.md, task JSONs, TODO_LIST.md) for te
IMPORTANT: This is TEST PLANNING ONLY - you are generating planning documents, NOT executing tests.
CRITICAL: Follow the progressive loading strategy defined in your agent specification (load context incrementally from memory-first approach)
CRITICAL:
- Use existing test frameworks and utilities from the project
- Follow the progressive loading strategy defined in your agent specification (load context incrementally from memory-first approach)
## AGENT CONFIGURATION REFERENCE
All test task generation rules, schemas, and quality standards are defined in your agent specification:
@@ -124,6 +127,7 @@ Task Configuration:
IMPL-001 (Test Generation):
- meta.type: "test-gen"
- meta.agent: "@code-developer" (agent-mode) OR CLI execution (cli-execute-mode)
- meta.test_framework: Specify existing framework (e.g., "jest", "vitest", "pytest")
- flow_control: Test generation strategy from TEST_ANALYSIS_RESULTS.md
IMPL-002+ (Test Execution & Fix):
@@ -144,7 +148,9 @@ Required flow_control fields:
### TEST_ANALYSIS_RESULTS.md Mapping
PRIMARY requirements source - extract and map to task JSONs:
- Test framework config → meta.test_framework
- Test framework config → meta.test_framework (use existing framework from project)
- Existing test utilities → flow_control.reusable_test_tools (discovered test helpers, fixtures, mocks)
- Test runner commands → flow_control.test_commands (from package.json or pytest config)
- Coverage targets → meta.coverage_target
- Test requirements → context.requirements (quantified with explicit counts)
- Test generation strategy → IMPL-001 flow_control.implementation_approach
@@ -154,6 +160,7 @@ PRIMARY requirements source - extract and map to task JSONs:
1. Test Task JSON Files (.task/IMPL-*.json)
- 6-field schema with quantified requirements from TEST_ANALYSIS_RESULTS.md
- Test-specific metadata: type, agent, use_codex, test_framework, coverage_target
- flow_control includes: reusable_test_tools, test_commands (from project config)
- Artifact references from test-context-package.json
- Absolute paths in context.files_to_test
@@ -172,7 +179,8 @@ PRIMARY requirements source - extract and map to task JSONs:
Hard Constraints:
- Task count: minimum 2, maximum 12
- All requirements quantified from TEST_ANALYSIS_RESULTS.md
- Test framework configuration validated
- Test framework matches existing project framework
- flow_control includes reusable_test_tools and test_commands from project
- use_codex flag correctly set in IMPL-002+ tasks
- Absolute paths for all focus_paths
- Acceptance criteria include verification commands