id = "test-generation" name = "Test Suite Generation" description = "Analyse code to generate comprehensive unit tests, integration tests, and edge case coverage." category = "engineering" tags = ["testing", "quality", "engineering", "tdd"] [i18n.zh] name = "测试用例生成" description = "分析代码,生成完整的单元测试、集成测试和边界情况覆盖。" [[parameters]] name = "code" description = "Source code to generate tests for" param_type = "string" required = true [[parameters]] name = "language" description = "Programming language and test framework to use" param_type = "string" required = false default = "auto-detect" [[steps]] name = "code_analysis" prompt_template = """ Analyse the following {{language}} code as a QA engineer: 1. List every public function/method and its contract (inputs → outputs) 2. Identify all branches and conditional paths 3. Note external dependencies that need mocking 4. Flag complex logic most likely to contain bugs 5. List data types and their valid/invalid ranges Code: {{code}} """ [[steps]] name = "edge_cases" prompt_template = """ Based on the code analysis, enumerate all edge cases and boundary conditions: - Null/empty/zero inputs - Maximum/minimum values - Concurrent access scenarios - Error propagation paths - State machine transitions - External dependency failures Code analysis: {{code_analysis}} """ depends_on = ["code_analysis"] [[steps]] name = "test_suite" prompt_template = """ Write a complete test suite in {{language}} covering: 1. **Happy path tests** — one per public function 2. **Edge case tests** — from the edge case list 3. **Error handling tests** — each error path 4. **Integration tests** — cross-component interactions Use descriptive test names following the pattern: `test___`. Include setup/teardown where needed. Add a comment explaining the intent of non-obvious tests. Code: {{code}} Edge cases: {{edge_cases}} """ depends_on = ["code_analysis", "edge_cases"]