Test Generator
Creates test plans and test cases (unit, integration, edge cases) based on existing or planned code
- License 许可
- MIT
- 最近更新
- 2026-06-22
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- Test Generator
- tags
- [ "testing", "quality", "coverage" ]
- author
- ForgeWeave Core
- version
- 1.0.0
- skill_id
- test-generator
- description
- Creates test plans and test cases (unit, integration, edge cases) based on existing or planned code
- tui_compatibility
- [ "opencode", "claude", "gemini", "qwen" ]
02 资源文件 2
- 参考文档references/testing-guidelines.md931 B
- 脚本scripts/detect_framework.py1.7 KB
03 SKILL.md 正文
Test Generator
Purpose
Analyze existing or planned code and produce comprehensive test suites. Covers unit tests for individual functions, integration tests for module interactions, and edge case tests for boundary conditions. Detects the project's test framework automatically.
When to Use
- New code has been written without tests
- Existing code lacks coverage in critical paths
- A bug was fixed and a regression test is needed
- The user explicitly asks for tests
When Not to Use
- The code is prototype or throwaway
- The user asked for debugging, not testing
- The testing strategy needs architectural design first
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
target |
string | Yes | File, module, or feature to test |
type |
enum | No (default: all) | unit, integration, edge-case, all |
framework |
string | No | Test framework (auto-detected if omitted) |
Expected Outputs
| Output | Description |
|---|---|
| Test files | New test files following project conventions |
| Coverage report | What's covered and what's not |
| Test run command | How to execute the tests |
Exact Workflow Steps
- Detect test framework from project config (Jest, Vitest, pytest, etc.)
- Read the target code and identify all exported functions, classes, and behaviors
- For each function: test happy path, error cases, edge cases (empty input, null, boundaries)
- Create test file following existing test conventions (naming, location, patterns)
- Mock external dependencies (APIs, databases, file system)
- Run tests to confirm they pass
Required Checks
- [ ] All tests pass
- [ ] Edge cases are covered (not just happy path)
- [ ] Mocks are used for external dependencies
- [ ] Tests are deterministic (no flaky tests)
Failure Modes
| Failure Condition | Response |
|---|---|
| Test framework not detectable | Ask user to specify framework |
| Tests fail due to code bugs | Report failing tests and suggest fixes |
| Mock is too complex | Suggest integration test instead of mocked unit test |
References
| Reference | Path |
|---|---|
| Code Builder skill | ../code-builder/SKILL.md |
| Debugger skill | ../debugger/SKILL.md |
04 同仓库更多 Skills
Workflow Orchestrator
Coordinates multi-skill execution pipelines (e.g., research → plan → build → test)
Web Research
Browser-driven or scraping-based skill for real-time internet extraction using Playwright and HTTP-based fetching
Validation Engine
Checks outputs from other skills for consistency, correctness, and adherence to AGENTS.md rules
Tool Selector
Determines which tools, APIs, MCP actions, or system capabilities are required for a given task
Test Generator
Creates test plans and test cases (unit, integration, edge cases) based on existing or planned code
Skill Generator
Meta-skill that creates new SKILL.md files from research outputs and patterns discovered in execution