claudecode-omc 4.7.4 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +50 -0
- package/agents/test-engineer.md +74 -0
- package/bridge/cli.cjs +9335 -117
- package/dist/cli/index.js +201 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/testing/analyzers/complexity.d.ts +18 -0
- package/dist/testing/analyzers/complexity.d.ts.map +1 -0
- package/dist/testing/analyzers/complexity.js +121 -0
- package/dist/testing/analyzers/complexity.js.map +1 -0
- package/dist/testing/analyzers/coverage.d.ts +13 -0
- package/dist/testing/analyzers/coverage.d.ts.map +1 -0
- package/dist/testing/analyzers/coverage.js +99 -0
- package/dist/testing/analyzers/coverage.js.map +1 -0
- package/dist/testing/analyzers/quality-scorer.d.ts +8 -0
- package/dist/testing/analyzers/quality-scorer.d.ts.map +1 -0
- package/dist/testing/analyzers/quality-scorer.js +128 -0
- package/dist/testing/analyzers/quality-scorer.js.map +1 -0
- package/dist/testing/analyzers/types.d.ts +56 -0
- package/dist/testing/analyzers/types.d.ts.map +1 -0
- package/dist/testing/analyzers/types.js +2 -0
- package/dist/testing/analyzers/types.js.map +1 -0
- package/dist/testing/cli/agent-integration.d.ts +20 -0
- package/dist/testing/cli/agent-integration.d.ts.map +1 -0
- package/dist/testing/cli/agent-integration.js +60 -0
- package/dist/testing/cli/agent-integration.js.map +1 -0
- package/dist/testing/cli/commands.d.ts +100 -0
- package/dist/testing/cli/commands.d.ts.map +1 -0
- package/dist/testing/cli/commands.js +250 -0
- package/dist/testing/cli/commands.js.map +1 -0
- package/dist/testing/cli/ultraqa-integration.d.ts +13 -0
- package/dist/testing/cli/ultraqa-integration.d.ts.map +1 -0
- package/dist/testing/cli/ultraqa-integration.js +68 -0
- package/dist/testing/cli/ultraqa-integration.js.map +1 -0
- package/dist/testing/detectors/go.d.ts +3 -0
- package/dist/testing/detectors/go.d.ts.map +1 -0
- package/dist/testing/detectors/go.js +38 -0
- package/dist/testing/detectors/go.js.map +1 -0
- package/dist/testing/detectors/index.d.ts +8 -0
- package/dist/testing/detectors/index.d.ts.map +1 -0
- package/dist/testing/detectors/index.js +46 -0
- package/dist/testing/detectors/index.js.map +1 -0
- package/dist/testing/detectors/package-json.d.ts +3 -0
- package/dist/testing/detectors/package-json.d.ts.map +1 -0
- package/dist/testing/detectors/package-json.js +52 -0
- package/dist/testing/detectors/package-json.js.map +1 -0
- package/dist/testing/detectors/python.d.ts +3 -0
- package/dist/testing/detectors/python.d.ts.map +1 -0
- package/dist/testing/detectors/python.js +37 -0
- package/dist/testing/detectors/python.js.map +1 -0
- package/dist/testing/detectors/rust.d.ts +3 -0
- package/dist/testing/detectors/rust.d.ts.map +1 -0
- package/dist/testing/detectors/rust.js +39 -0
- package/dist/testing/detectors/rust.js.map +1 -0
- package/dist/testing/generators/contract.d.ts +14 -0
- package/dist/testing/generators/contract.d.ts.map +1 -0
- package/dist/testing/generators/contract.js +163 -0
- package/dist/testing/generators/contract.js.map +1 -0
- package/dist/testing/generators/e2e.d.ts +34 -0
- package/dist/testing/generators/e2e.d.ts.map +1 -0
- package/dist/testing/generators/e2e.js +74 -0
- package/dist/testing/generators/e2e.js.map +1 -0
- package/dist/testing/generators/go.d.ts +12 -0
- package/dist/testing/generators/go.d.ts.map +1 -0
- package/dist/testing/generators/go.js +144 -0
- package/dist/testing/generators/go.js.map +1 -0
- package/dist/testing/generators/nodejs.d.ts +12 -0
- package/dist/testing/generators/nodejs.d.ts.map +1 -0
- package/dist/testing/generators/nodejs.js +37 -0
- package/dist/testing/generators/nodejs.js.map +1 -0
- package/dist/testing/generators/python.d.ts +12 -0
- package/dist/testing/generators/python.d.ts.map +1 -0
- package/dist/testing/generators/python.js +163 -0
- package/dist/testing/generators/python.js.map +1 -0
- package/dist/testing/generators/react.d.ts +12 -0
- package/dist/testing/generators/react.d.ts.map +1 -0
- package/dist/testing/generators/react.js +31 -0
- package/dist/testing/generators/react.js.map +1 -0
- package/dist/testing/generators/rust.d.ts +11 -0
- package/dist/testing/generators/rust.d.ts.map +1 -0
- package/dist/testing/generators/rust.js +138 -0
- package/dist/testing/generators/rust.js.map +1 -0
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +11 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/integrations/autopilot.d.ts +42 -0
- package/dist/testing/integrations/autopilot.d.ts.map +1 -0
- package/dist/testing/integrations/autopilot.js +55 -0
- package/dist/testing/integrations/autopilot.js.map +1 -0
- package/dist/testing/integrations/cicd.d.ts +26 -0
- package/dist/testing/integrations/cicd.d.ts.map +1 -0
- package/dist/testing/integrations/cicd.js +162 -0
- package/dist/testing/integrations/cicd.js.map +1 -0
- package/dist/testing/integrations/giskard/behavioral-tests.d.ts +4 -0
- package/dist/testing/integrations/giskard/behavioral-tests.d.ts.map +1 -0
- package/dist/testing/integrations/giskard/behavioral-tests.js +66 -0
- package/dist/testing/integrations/giskard/behavioral-tests.js.map +1 -0
- package/dist/testing/integrations/giskard/types.d.ts +35 -0
- package/dist/testing/integrations/giskard/types.d.ts.map +1 -0
- package/dist/testing/integrations/giskard/types.js +2 -0
- package/dist/testing/integrations/giskard/types.js.map +1 -0
- package/dist/testing/integrations/promptfoo/config-generator.d.ts +5 -0
- package/dist/testing/integrations/promptfoo/config-generator.d.ts.map +1 -0
- package/dist/testing/integrations/promptfoo/config-generator.js +44 -0
- package/dist/testing/integrations/promptfoo/config-generator.js.map +1 -0
- package/dist/testing/integrations/promptfoo/types.d.ts +36 -0
- package/dist/testing/integrations/promptfoo/types.d.ts.map +1 -0
- package/dist/testing/integrations/promptfoo/types.js +2 -0
- package/dist/testing/integrations/promptfoo/types.js.map +1 -0
- package/dist/testing/integrations/ralph.d.ts +65 -0
- package/dist/testing/integrations/ralph.d.ts.map +1 -0
- package/dist/testing/integrations/ralph.js +69 -0
- package/dist/testing/integrations/ralph.js.map +1 -0
- package/dist/testing/performance/cache-manager.d.ts +16 -0
- package/dist/testing/performance/cache-manager.d.ts.map +1 -0
- package/dist/testing/performance/cache-manager.js +39 -0
- package/dist/testing/performance/cache-manager.js.map +1 -0
- package/dist/testing/performance/parallel-generator.d.ts +23 -0
- package/dist/testing/performance/parallel-generator.d.ts.map +1 -0
- package/dist/testing/performance/parallel-generator.js +31 -0
- package/dist/testing/performance/parallel-generator.js.map +1 -0
- package/dist/testing/types.d.ts +23 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing/types.js +2 -0
- package/dist/testing/types.js.map +1 -0
- package/docs/2026-03-06-llm-testing-system-phase1.md +0 -0
- package/docs/plans/2026-03-06-llm-testing-system-design.md +311 -0
- package/docs/plans/2026-03-06-llm-testing-system-phase1.md +1268 -0
- package/docs/plans/2026-03-06-llm-testing-system-phase2.md +3053 -0
- package/docs/plans/2026-03-06-llm-testing-system-phase3.md +1830 -0
- package/docs/testing/PHASE2.md +266 -0
- package/docs/testing/PHASE3.md +601 -0
- package/docs/testing/README.md +634 -0
- package/package.json +1 -1
- package/skills/test-gen/skill.md +531 -0
- package/skills/ultraqa.md +58 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-gen
|
|
3
|
+
description: Generate tests for code files using LLM-driven test generation. Detects tech stack, analyzes code complexity, and generates appropriate tests. Use when user asks to "generate tests", "add tests", "create test coverage", or explicitly invokes /test-gen.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Generation Skill
|
|
7
|
+
|
|
8
|
+
Generate comprehensive tests for code files with automatic tech stack detection and complexity analysis.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
/test-gen <file-path>
|
|
14
|
+
/test-gen src/components/Button.tsx
|
|
15
|
+
/test-gen src/utils/math.ts --coverage-analysis
|
|
16
|
+
/test-gen src/utils/math.py
|
|
17
|
+
/test-gen pkg/math/math.go
|
|
18
|
+
/test-gen src/math.rs
|
|
19
|
+
/test-gen api/openapi.yaml --contract
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
### Step 1: Detect Tech Stack
|
|
25
|
+
|
|
26
|
+
Use the `omc test detect-stack` command to identify:
|
|
27
|
+
- Frontend framework (React/Vue/Svelte)
|
|
28
|
+
- Backend language (Node.js/Python/Go/Rust)
|
|
29
|
+
- Test frameworks (Vitest/Jest/pytest/Go testing/cargo test)
|
|
30
|
+
- Databases and API types
|
|
31
|
+
|
|
32
|
+
Supported detection methods:
|
|
33
|
+
- **Node.js**: package.json parsing
|
|
34
|
+
- **Python**: requirements.txt / pyproject.toml
|
|
35
|
+
- **Go**: go.mod
|
|
36
|
+
- **Rust**: Cargo.toml
|
|
37
|
+
|
|
38
|
+
### Step 2: Analyze Code Complexity
|
|
39
|
+
|
|
40
|
+
Run complexity analysis to determine routing:
|
|
41
|
+
|
|
42
|
+
**Simple (auto-generate tests)**:
|
|
43
|
+
- Function lines < 50
|
|
44
|
+
- Cyclomatic complexity < 10
|
|
45
|
+
- Nesting level < 3
|
|
46
|
+
- No external dependencies
|
|
47
|
+
|
|
48
|
+
**Complex (generate framework + prompt for details)**:
|
|
49
|
+
- Payment/auth logic
|
|
50
|
+
- Multi-step workflows
|
|
51
|
+
- External service dependencies
|
|
52
|
+
- Async/concurrent scenarios
|
|
53
|
+
- Database transactions
|
|
54
|
+
|
|
55
|
+
Complexity metrics calculated:
|
|
56
|
+
- Lines of code
|
|
57
|
+
- Cyclomatic complexity (branches, loops, ternaries)
|
|
58
|
+
- Maximum nesting depth
|
|
59
|
+
- External dependency count
|
|
60
|
+
|
|
61
|
+
### Step 3: Route to Appropriate Generator
|
|
62
|
+
|
|
63
|
+
Based on detected language and complexity:
|
|
64
|
+
|
|
65
|
+
| Language | Simple | Complex |
|
|
66
|
+
|----------|--------|---------|
|
|
67
|
+
| Node.js/TypeScript | `omc test gen` -> Vitest/Jest tests | Delegate to `test-engineer` |
|
|
68
|
+
| React | `omc test gen` -> Component tests | Delegate to `test-engineer` |
|
|
69
|
+
| Python | `omc test gen` -> pytest/unittest tests | Delegate to `test-engineer` |
|
|
70
|
+
| Go | `omc test gen` -> Table-driven tests | Delegate to `test-engineer` |
|
|
71
|
+
| Rust | `omc test gen` -> #[test] module | Delegate to `test-engineer` |
|
|
72
|
+
|
|
73
|
+
### Step 4: Generate Tests
|
|
74
|
+
|
|
75
|
+
### Step 4: Generate Tests
|
|
76
|
+
|
|
77
|
+
For simple code:
|
|
78
|
+
- Call `omc test gen <file>` directly
|
|
79
|
+
- Routes to language-specific generator (Node.js, Python, Go, Rust)
|
|
80
|
+
- Review generated tests
|
|
81
|
+
- Commit
|
|
82
|
+
|
|
83
|
+
For complex code:
|
|
84
|
+
- Generate test framework with `omc test gen <file>`
|
|
85
|
+
- Delegate to enhanced `test-engineer` agent with enriched context (tech stack, complexity metrics, suggested approach)
|
|
86
|
+
- Prompt user for business logic validation
|
|
87
|
+
|
|
88
|
+
### Step 5: Coverage Analysis (Optional)
|
|
89
|
+
|
|
90
|
+
If `--coverage-analysis` flag is provided:
|
|
91
|
+
- Run coverage tools (c8/nyc for Node.js)
|
|
92
|
+
- Parse coverage reports and identify gaps
|
|
93
|
+
- Analyze reasons for uncovered code (error handling, branches, null checks)
|
|
94
|
+
- Generate supplementary tests targeting gaps
|
|
95
|
+
- Re-run coverage to verify improvement
|
|
96
|
+
|
|
97
|
+
### Step 6: Contract Testing (Optional)
|
|
98
|
+
|
|
99
|
+
If `--contract` flag is provided or file is an OpenAPI spec:
|
|
100
|
+
- Parse OpenAPI/Swagger specification
|
|
101
|
+
- Generate contract tests using Pact, Supertest, or MSW
|
|
102
|
+
- Create consumer-driven contract tests for each endpoint
|
|
103
|
+
- Include request/response validation
|
|
104
|
+
|
|
105
|
+
## Integration with Other Skills
|
|
106
|
+
|
|
107
|
+
- Works with `/tdd` for test-first development
|
|
108
|
+
- Integrates with `/ultraqa` for test-verify-fix loops
|
|
109
|
+
- Called automatically by `/autopilot` when generating code
|
|
110
|
+
- **Phase 3**: Integrates with `/ralph` for automated test-fix-verify loops
|
|
111
|
+
|
|
112
|
+
## Phase 3 Workflows
|
|
113
|
+
|
|
114
|
+
### Promptfoo LLM Testing
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
User: Generate Promptfoo config for my code review prompt
|
|
118
|
+
Agent: /test-gen prompts/code-review.txt --promptfoo
|
|
119
|
+
|
|
120
|
+
Agent: Generating Promptfoo configuration...
|
|
121
|
+
✅ Generated: promptfoo.config.yaml
|
|
122
|
+
|
|
123
|
+
Config includes:
|
|
124
|
+
- Prompt file: prompts/code-review.txt
|
|
125
|
+
- Provider: anthropic:claude-3-5-sonnet-20241022
|
|
126
|
+
- Test cases: Ready for customization
|
|
127
|
+
|
|
128
|
+
Next steps:
|
|
129
|
+
1. Add test cases to promptfoo.config.yaml
|
|
130
|
+
2. Run: npx promptfoo eval
|
|
131
|
+
3. View results: npx promptfoo view
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### E2E Test Generation
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
User: Generate E2E tests for the login flow
|
|
138
|
+
Agent: /test-gen "User logs in, navigates to dashboard, clicks on settings" --e2e
|
|
139
|
+
|
|
140
|
+
Agent: Generating Playwright E2E tests...
|
|
141
|
+
✅ Generated: tests/e2e/user-flow.spec.ts
|
|
142
|
+
|
|
143
|
+
Test includes:
|
|
144
|
+
- Navigate to login page
|
|
145
|
+
- Navigate to dashboard
|
|
146
|
+
- Click settings link
|
|
147
|
+
|
|
148
|
+
Would you like me to:
|
|
149
|
+
1. Add more detailed assertions?
|
|
150
|
+
2. Generate additional E2E flows?
|
|
151
|
+
3. Set up Playwright config?
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Giskard Behavioral Testing
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
User: Generate behavioral tests for my classifier
|
|
158
|
+
Agent: /test-gen src/models/classifier.ts --giskard
|
|
159
|
+
|
|
160
|
+
Agent: Generating Giskard behavioral tests...
|
|
161
|
+
✅ Grated: tests/behavioral/perturbation.test.ts
|
|
162
|
+
|
|
163
|
+
Tests include:
|
|
164
|
+
- Typo perturbations
|
|
165
|
+
- Negation perturbations
|
|
166
|
+
- Synonym perturbations
|
|
167
|
+
|
|
168
|
+
Agent: These tests verify model robustness under input variations.
|
|
169
|
+
Would you like me to:
|
|
170
|
+
1. Add robustness tests?
|
|
171
|
+
2. Customize perturbation types?
|
|
172
|
+
3. Run the behavioral tests?
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### CI/CD Workflow Generation
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
User: Set up CI/CD for testing
|
|
179
|
+
Agent: /test-gen --cicd
|
|
180
|
+
|
|
181
|
+
Agent: Generating GitHub Actions workflow...
|
|
182
|
+
✅ Generated: .github/workflows/test.yml
|
|
183
|
+
|
|
184
|
+
Workflow includes:
|
|
185
|
+
- Node.js setup with pnpm
|
|
186
|
+
- Test execution
|
|
187
|
+
- Coverage reporting (Codecov)
|
|
188
|
+
- Test artifact uploads
|
|
189
|
+
|
|
190
|
+
Would you like me to:
|
|
191
|
+
1. Add matrix builds for multiple Node versions?
|
|
192
|
+
2. Add deployment steps?
|
|
193
|
+
3. Commit the workflow?
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Test Quality Scoring
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
User: Check the quality of my tests
|
|
200
|
+
Agent: /test-gen tests/utils/parser.test.ts --quality
|
|
201
|
+
|
|
202
|
+
Agent: Analyzing test quality...
|
|
203
|
+
📊 Test Quality Score: 85/100
|
|
204
|
+
|
|
205
|
+
Breakdown:
|
|
206
|
+
- Completeness: 90/100
|
|
207
|
+
- Assertions: 80/100
|
|
208
|
+
- Independence: 95/100
|
|
209
|
+
- Naming: 75/100
|
|
210
|
+
|
|
211
|
+
💡 Recommendations:
|
|
212
|
+
- Test edge cases like null, undefined, empty values
|
|
213
|
+
- Use descriptive test names that explain what is being tested
|
|
214
|
+
- Improve assertion quality with more specific matchers
|
|
215
|
+
|
|
216
|
+
Would you like me to:
|
|
217
|
+
1. Fix the identified issues?
|
|
218
|
+
2. Generate additional test cases?
|
|
219
|
+
3. Re-score after improvements?
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Ralph Mode Integration
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
User: ralph mode - implement authentication with comprehensive testing
|
|
226
|
+
Agent: Starting Ralph mode with testing integration...
|
|
227
|
+
|
|
228
|
+
Agent: Phase 1 - Implementation
|
|
229
|
+
✅ Generated: src/auth/authenticate.ts
|
|
230
|
+
|
|
231
|
+
Agent: Phase 2 - Test Generation
|
|
232
|
+
✅ Generated: src/auth/authenticate.test.ts
|
|
233
|
+
|
|
234
|
+
Agent: Phase 3 - Quality Check
|
|
235
|
+
📊 Test Quality Score: 72/100
|
|
236
|
+
⚠️ Below threshold (80)
|
|
237
|
+
|
|
238
|
+
Agent: Phase 4 - Test Improvement
|
|
239
|
+
✅ Added edge case tests
|
|
240
|
+
✅ Improved assertion specificity
|
|
241
|
+
✅ Added descriptive test names
|
|
242
|
+
|
|
243
|
+
Agent: Phase 5 - Re-verification
|
|
244
|
+
📊 Test Quality Score: 88/100
|
|
245
|
+
✅ Meets quality threshold
|
|
246
|
+
|
|
247
|
+
Agent: Phase 6 - E2E Tests
|
|
248
|
+
✅ Generated: tests/e2e/auth-flow.spec.ts
|
|
249
|
+
|
|
250
|
+
Agent: Phase 7 - Behavioral Tests
|
|
251
|
+
✅ Generated: tests/behavioral/auth-robustness.test.ts
|
|
252
|
+
|
|
253
|
+
Agent: Phase 8 - CI/CD Setup
|
|
254
|
+
✅ Generated: .github/workflows/test.yml
|
|
255
|
+
|
|
256
|
+
All tests passing. Quality threshold met. Ready to commit.
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Autopilot Testing Phase
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
User: autopilot - build a REST API for tasks
|
|
263
|
+
Agent: Starting Autopilot with comprehensive testing...
|
|
264
|
+
|
|
265
|
+
Agent: Phase 1 - Planning
|
|
266
|
+
✅ Architecture designed
|
|
267
|
+
|
|
268
|
+
Agent: Phase 2 - Implementation
|
|
269
|
+
✅ Generated API endpoints
|
|
270
|
+
|
|
271
|
+
Agent: Phase 3 - Unit Tests
|
|
272
|
+
✅ Generated unit tests for all endpoints
|
|
273
|
+
|
|
274
|
+
Agent: Phase 4 - Integration Tests
|
|
275
|
+
✅ Generated integration tests
|
|
276
|
+
|
|
277
|
+
Agent: Phase 5 - Contract Tests
|
|
278
|
+
✅ Generated contract tests from OpenAPI spec
|
|
279
|
+
|
|
280
|
+
Agent: Phase 6 - E2E Tests
|
|
281
|
+
✅ Generated E2E tests for critical flows
|
|
282
|
+
|
|
283
|
+
Agent: Phase 7 - Quality Scoring
|
|
284
|
+
📊 Average Test Quality: 86/100
|
|
285
|
+
✅ All tests meet quality threshold
|
|
286
|
+
|
|
287
|
+
Agent: Phase 8 - Behavioral Tests
|
|
288
|
+
✅ Generated robustness tests
|
|
289
|
+
|
|
290
|
+
Agent: Phase 9 - CI/CD Setup
|
|
291
|
+
✅ Generated GitHub Actions workflow
|
|
292
|
+
|
|
293
|
+
Agent: Phase 10 - Verification
|
|
294
|
+
✅ All tests passing
|
|
295
|
+
✅ Coverage: 92%
|
|
296
|
+
✅ Build successful
|
|
297
|
+
|
|
298
|
+
Ready for deployment.
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Examples
|
|
302
|
+
|
|
303
|
+
### Example 1: Simple React Component
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
User: /test-gen src/components/Button.tsx
|
|
307
|
+
Agent: Detecting tech stack...
|
|
308
|
+
✅ Detected: React + Vitest
|
|
309
|
+
|
|
310
|
+
Agent: Analyzing complexity...
|
|
311
|
+
✅ Simple component (25 lines, no external deps)
|
|
312
|
+
|
|
313
|
+
Agent: Generating tests...
|
|
314
|
+
✅ Generated: src/components/Button.test.tsx
|
|
315
|
+
|
|
316
|
+
Tests include:
|
|
317
|
+
- Renders children correctly
|
|
318
|
+
- Handles onClick events
|
|
319
|
+
- Accessibility checks
|
|
320
|
+
|
|
321
|
+
Would you like me to commit these tests?
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Example 2: Complex Payment Service
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
User: /test-gen src/services/payment.ts
|
|
328
|
+
|
|
329
|
+
Agent: Detecting tech stack...
|
|
330
|
+
✅ Detected: Node.js + Express + PostgreSQL + Vitest
|
|
331
|
+
|
|
332
|
+
Agent: Analyzing complexity...
|
|
333
|
+
⚠️ Complex code detected:
|
|
334
|
+
- Payment processing logic
|
|
335
|
+
- External Stripe API calls
|
|
336
|
+
- Database transactions
|
|
337
|
+
- Error handling for multiple scenarios
|
|
338
|
+
|
|
339
|
+
Agent: Generating test framework...
|
|
340
|
+
✅ Generated: src/services/payment.test.ts (framework)
|
|
341
|
+
|
|
342
|
+
Agent: Delegating to test-engineer for detailed test cases...
|
|
343
|
+
|
|
344
|
+
Test-Engineer: I'll need some information:
|
|
345
|
+
1. What are the expected payment flows? (success, failure, retry)
|
|
346
|
+
2. Should I mock Stripe API calls?
|
|
347
|
+
3. What database states should I test?
|
|
348
|
+
4. Are there specific edge cases to cover?
|
|
349
|
+
|
|
350
|
+
[User provides details]
|
|
351
|
+
|
|
352
|
+
Test-Engineer: Generating comprehensive test suite...
|
|
353
|
+
✅ Generated 15 test cases covering:
|
|
354
|
+
- Happy path payment processing
|
|
355
|
+
- Stripe API failure scenarios
|
|
356
|
+
- Database transaction rollbacks
|
|
357
|
+
- Idempotency checks
|
|
358
|
+
- Concurrent payment handling
|
|
359
|
+
|
|
360
|
+
Would you like me to commit these tests?
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Example 3: Coverage Analysis
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
User: /test-gen src/utils/validation.ts --coverage-analysis
|
|
367
|
+
|
|
368
|
+
Agent: Generating initial tests...
|
|
369
|
+
✅ Generated: src/utils/validation.test.ts
|
|
370
|
+
|
|
371
|
+
Agent: Running coverage analysis...
|
|
372
|
+
📊 Current coverage: 65%
|
|
373
|
+
|
|
374
|
+
Missing coverage:
|
|
375
|
+
- Line 42-48: Error handling for invalid email formats
|
|
376
|
+
- Line 67-72: Edge case for international phone numbers
|
|
377
|
+
- Line 89: Null check branch
|
|
378
|
+
|
|
379
|
+
Agent: Generating supplementary tests...
|
|
380
|
+
✅ Added 5 additional test cases
|
|
381
|
+
|
|
382
|
+
Agent: Re-running coverage...
|
|
383
|
+
📊 New coverage: 92%
|
|
384
|
+
|
|
385
|
+
Would you like me to commit these tests?
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Example 4: Python Test Generation
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
User: /test-gen src/calculator.py
|
|
392
|
+
|
|
393
|
+
Agent: Detecting tech stack...
|
|
394
|
+
✅ Detected: Python + pytest
|
|
395
|
+
|
|
396
|
+
Agent: Analyzing complexity...
|
|
397
|
+
✅ Simple module (30 lines, no external deps)
|
|
398
|
+
|
|
399
|
+
Agent: Generating tests...
|
|
400
|
+
✅ Generated: tests/test_calculator.py
|
|
401
|
+
|
|
402
|
+
Tests include:
|
|
403
|
+
- test_add
|
|
404
|
+
- test_subtract
|
|
405
|
+
- test_multiply
|
|
406
|
+
- test_divide
|
|
407
|
+
- test_divide_by_zero
|
|
408
|
+
|
|
409
|
+
Would you like me to commit these tests?
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Example 5: Go Test Generation
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
User: /test-gen pkg/math/math.go
|
|
416
|
+
|
|
417
|
+
Agent: Detecting tech stack...
|
|
418
|
+
✅ Detected: Go + testing package
|
|
419
|
+
|
|
420
|
+
Agent: Analyzing complexity...
|
|
421
|
+
✅ Simple package (40 lines, no external deps)
|
|
422
|
+
|
|
423
|
+
Agent: Generating tests...
|
|
424
|
+
✅ Generated: pkg/math/math_test.go
|
|
425
|
+
|
|
426
|
+
Tests include:
|
|
427
|
+
- TestAdd (table-driven with 3 cases)
|
|
428
|
+
- TestSubtract (table-driven with 3 cases)
|
|
429
|
+
- TestMultiply (table-driven with 3 cases)
|
|
430
|
+
|
|
431
|
+
Would you like me to commit these tests?
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Example 6: Rust Test Generation
|
|
435
|
+
|
|
436
|
+
```
|
|
437
|
+
User: /test-gen src/math.rs
|
|
438
|
+
|
|
439
|
+
Agent: Detecting tech stack...
|
|
440
|
+
✅ Detected: Rust + cargo test
|
|
441
|
+
|
|
442
|
+
Agent: Analyzing complexity...
|
|
443
|
+
✅ Simple module (35 lines, no external deps)
|
|
444
|
+
|
|
445
|
+
Agent: Generating tests...
|
|
446
|
+
✅ Generated: test module appended to src/math.rs
|
|
447
|
+
|
|
448
|
+
Tests include:
|
|
449
|
+
- test_add
|
|
450
|
+
- test_subtract
|
|
451
|
+
- test_calculator_new
|
|
452
|
+
|
|
453
|
+
Would you like me to commit these tests?
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Example 7: Contract Testing
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
User: /test-gen api/openapi.yaml --contract
|
|
460
|
+
|
|
461
|
+
Agent: Parsing OpenAPI specification...
|
|
462
|
+
✅ Found 4 endpoints
|
|
463
|
+
|
|
464
|
+
Agent: Generating contract tests...
|
|
465
|
+
✅ Generated: tests/contract/api.pact.test.ts
|
|
466
|
+
|
|
467
|
+
Contract tests:
|
|
468
|
+
- GET /users/{id} -> 200 (User found)
|
|
469
|
+
- POST /users -> 201 (User created)
|
|
470
|
+
- PUT /users/{id} -> 200 (User updated)
|
|
471
|
+
- DELETE /users/{id} -> 204 (User deleted)
|
|
472
|
+
|
|
473
|
+
Would you like me to commit these tests?
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Integration Notes
|
|
477
|
+
|
|
478
|
+
### With Test-Engineer Agent
|
|
479
|
+
|
|
480
|
+
The `/test-gen` skill enhances the existing `test-engineer` agent by:
|
|
481
|
+
|
|
482
|
+
1. **Automatic invocation**: When user asks to "generate tests", invoke `/test-gen` instead of directly calling `test-engineer`
|
|
483
|
+
2. **Context enrichment**: Pass detected tech stack and complexity analysis to `test-engineer`
|
|
484
|
+
3. **Workflow guidance**: Provide structured workflow for test generation
|
|
485
|
+
|
|
486
|
+
Update `agents/test-engineer.md` to reference `/test-gen`:
|
|
487
|
+
|
|
488
|
+
```markdown
|
|
489
|
+
## When to Use
|
|
490
|
+
|
|
491
|
+
- User explicitly asks for test generation → Use `/test-gen` skill first
|
|
492
|
+
- User asks for test strategy/planning → Use test-engineer directly
|
|
493
|
+
- User asks for test debugging → Use test-engineer directly
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### With Autopilot
|
|
497
|
+
|
|
498
|
+
Update `skills/autopilot.md` to include test generation:
|
|
499
|
+
|
|
500
|
+
```markdown
|
|
501
|
+
## Phase 4: Testing
|
|
502
|
+
|
|
503
|
+
After implementation:
|
|
504
|
+
1. Run `/test-gen` on all new source files
|
|
505
|
+
2. Verify tests pass
|
|
506
|
+
3. Check coverage meets threshold (default: 80%)
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### With TDD Skill
|
|
510
|
+
|
|
511
|
+
Update `skills/tdd.md` to integrate:
|
|
512
|
+
|
|
513
|
+
```markdown
|
|
514
|
+
## Red Phase
|
|
515
|
+
|
|
516
|
+
Instead of manually writing tests, use:
|
|
517
|
+
```
|
|
518
|
+
/test-gen <file> --tdd-mode
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
This generates failing tests based on function signatures.
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
## Success Criteria
|
|
525
|
+
|
|
526
|
+
- [ ] Tech stack detection works for React + Node.js projects
|
|
527
|
+
- [ ] Test generation produces valid, runnable tests
|
|
528
|
+
- [ ] CLI commands (`omc test gen`, `omc test detect-stack`) work correctly
|
|
529
|
+
- [ ] `/test-gen` skill integrates with existing agent workflows
|
|
530
|
+
- [ ] All tests pass: `pnpm test tests/testing/**`
|
|
531
|
+
- [ ] Documentation is complete and accurate
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Enhanced Test Generation Integration
|
|
2
|
+
|
|
3
|
+
### Automatic Test Generation
|
|
4
|
+
|
|
5
|
+
UltraQA now automatically generates missing tests during the QA cycle:
|
|
6
|
+
|
|
7
|
+
1. **Identify Missing Tests**: Check which changed files lack test coverage
|
|
8
|
+
2. **Generate Tests**: Use `/test-gen` to create tests for uncovered files
|
|
9
|
+
3. **Run Tests**: Execute generated tests
|
|
10
|
+
4. **Analyze Coverage**: Identify remaining gaps
|
|
11
|
+
5. **Fix Issues**: If tests fail, fix and regenerate
|
|
12
|
+
6. **Repeat**: Continue until coverage threshold met (default: 80%)
|
|
13
|
+
|
|
14
|
+
### Workflow
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
User: /ultraqa
|
|
18
|
+
|
|
19
|
+
Agent: Starting UltraQA cycle...
|
|
20
|
+
|
|
21
|
+
Agent: Analyzing changed files...
|
|
22
|
+
- src/utils/math.ts (no test file)
|
|
23
|
+
- src/services/payment.ts (test exists, but coverage 45%)
|
|
24
|
+
|
|
25
|
+
Agent: Generating missing tests...
|
|
26
|
+
✅ Generated: src/utils/math.test.ts
|
|
27
|
+
|
|
28
|
+
Agent: Analyzing coverage gaps in src/services/payment.ts...
|
|
29
|
+
- Lines 42-48: Error handling not covered
|
|
30
|
+
- Lines 67-72: Edge case for retries
|
|
31
|
+
|
|
32
|
+
Agent: Generating supplementary tests...
|
|
33
|
+
✅ Added 3 test cases to src/services/payment.test.ts
|
|
34
|
+
|
|
35
|
+
Agent: Running all tests...
|
|
36
|
+
✅ All tests passing
|
|
37
|
+
|
|
38
|
+
Agent: Coverage analysis...
|
|
39
|
+
- Overall coverage: 85%
|
|
40
|
+
- src/utils/math.ts: 100%
|
|
41
|
+
- src/services/payment.ts: 82%
|
|
42
|
+
|
|
43
|
+
✅ UltraQA cycle complete. Coverage threshold met.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Configuration
|
|
47
|
+
|
|
48
|
+
Add to `.omc/project-config.json`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"ultraqa": {
|
|
53
|
+
"autoGenerateTests": true,
|
|
54
|
+
"coverageThreshold": 80,
|
|
55
|
+
"maxCycles": 5
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|