ace-test 0.6.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.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.ace-defaults/nav/protocols/agent-sources/ace-test.yml +19 -0
  3. data/.ace-defaults/nav/protocols/guide-sources/ace-test.yml +19 -0
  4. data/.ace-defaults/nav/protocols/tmpl-sources/ace-test.yml +11 -0
  5. data/.ace-defaults/nav/protocols/wfi-sources/ace-test.yml +19 -0
  6. data/CHANGELOG.md +169 -0
  7. data/LICENSE +21 -0
  8. data/README.md +40 -0
  9. data/Rakefile +12 -0
  10. data/handbook/agents/mock.ag.md +164 -0
  11. data/handbook/agents/profile-tests.ag.md +132 -0
  12. data/handbook/agents/test.ag.md +99 -0
  13. data/handbook/guides/SUMMARY.md +95 -0
  14. data/handbook/guides/embedded-testing-guide.g.md +261 -0
  15. data/handbook/guides/mocking-patterns.g.md +464 -0
  16. data/handbook/guides/quick-reference.g.md +46 -0
  17. data/handbook/guides/test-driven-development-cycle/meta-documentation.md +26 -0
  18. data/handbook/guides/test-driven-development-cycle/ruby-application.md +18 -0
  19. data/handbook/guides/test-driven-development-cycle/ruby-gem.md +19 -0
  20. data/handbook/guides/test-driven-development-cycle/rust-cli.md +18 -0
  21. data/handbook/guides/test-driven-development-cycle/rust-wasm-zed.md +19 -0
  22. data/handbook/guides/test-driven-development-cycle/typescript-nuxt.md +18 -0
  23. data/handbook/guides/test-driven-development-cycle/typescript-vue.md +19 -0
  24. data/handbook/guides/test-layer-decision.g.md +261 -0
  25. data/handbook/guides/test-mocking-patterns.g.md +414 -0
  26. data/handbook/guides/test-organization.g.md +140 -0
  27. data/handbook/guides/test-performance.g.md +353 -0
  28. data/handbook/guides/test-responsibility-map.g.md +220 -0
  29. data/handbook/guides/test-review-checklist.g.md +231 -0
  30. data/handbook/guides/test-suite-health.g.md +337 -0
  31. data/handbook/guides/testable-code-patterns.g.md +315 -0
  32. data/handbook/guides/testing/ruby-rspec-config-examples.md +120 -0
  33. data/handbook/guides/testing/ruby-rspec.md +87 -0
  34. data/handbook/guides/testing/rust.md +52 -0
  35. data/handbook/guides/testing/test-maintenance.md +364 -0
  36. data/handbook/guides/testing/typescript-bun.md +47 -0
  37. data/handbook/guides/testing/vue-firebase-auth.md +546 -0
  38. data/handbook/guides/testing/vue-vitest.md +236 -0
  39. data/handbook/guides/testing-philosophy.g.md +82 -0
  40. data/handbook/guides/testing-strategy.g.md +151 -0
  41. data/handbook/guides/testing-tdd-cycle.g.md +146 -0
  42. data/handbook/guides/testing.g.md +170 -0
  43. data/handbook/skills/as-test-create-cases/SKILL.md +24 -0
  44. data/handbook/skills/as-test-fix/SKILL.md +26 -0
  45. data/handbook/skills/as-test-improve-coverage/SKILL.md +22 -0
  46. data/handbook/skills/as-test-optimize/SKILL.md +34 -0
  47. data/handbook/skills/as-test-performance-audit/SKILL.md +34 -0
  48. data/handbook/skills/as-test-plan/SKILL.md +34 -0
  49. data/handbook/skills/as-test-review/SKILL.md +34 -0
  50. data/handbook/skills/as-test-verify-suite/SKILL.md +45 -0
  51. data/handbook/templates/e2e-sandbox-checklist.template.md +289 -0
  52. data/handbook/templates/test-case.template.md +56 -0
  53. data/handbook/templates/test-performance-audit.template.md +132 -0
  54. data/handbook/templates/test-responsibility-map.template.md +92 -0
  55. data/handbook/templates/test-review-checklist.template.md +163 -0
  56. data/handbook/workflow-instructions/test/analyze-failures.wf.md +120 -0
  57. data/handbook/workflow-instructions/test/create-cases.wf.md +675 -0
  58. data/handbook/workflow-instructions/test/fix.wf.md +120 -0
  59. data/handbook/workflow-instructions/test/improve-coverage.wf.md +370 -0
  60. data/handbook/workflow-instructions/test/optimize.wf.md +368 -0
  61. data/handbook/workflow-instructions/test/performance-audit.wf.md +17 -0
  62. data/handbook/workflow-instructions/test/plan.wf.md +323 -0
  63. data/handbook/workflow-instructions/test/review.wf.md +16 -0
  64. data/handbook/workflow-instructions/test/verify-suite.wf.md +343 -0
  65. data/lib/ace/test/version.rb +7 -0
  66. data/lib/ace/test.rb +10 -0
  67. metadata +152 -0
@@ -0,0 +1,675 @@
1
+ ---
2
+ doc-type: workflow
3
+ title: Create Test Cases Workflow Instruction
4
+ purpose: create-test-cases workflow instruction
5
+ ace-docs:
6
+ last-updated: 2026-03-12
7
+ last-checked: 2026-03-21
8
+ ---
9
+
10
+ # Create Test Cases Workflow Instruction
11
+
12
+ ## Goal
13
+
14
+ Generate a structured list of test cases following the ACE testing approach (atoms, molecules, organisms, e2e) for a specific feature, task, or code change based on requirements and comprehensive testing principles.
15
+
16
+ ## Prerequisites
17
+
18
+ - Clear understanding of the feature/task requirements
19
+ - Knowledge of the code changes or implementation approach
20
+ - Understanding of ACE test layers and their IO policies
21
+ - Access to existing test patterns in the codebase
22
+
23
+ ## Project Context Loading
24
+
25
+ - Read and follow: `ace-bundle wfi://bundle`
26
+
27
+ ## High-Level Execution Plan
28
+
29
+ ### Planning Steps
30
+
31
+ - [ ] Analyze requirements and identify testable components
32
+ - [ ] Identify test scenarios across different categories (happy path, edge cases, errors)
33
+ - [ ] Assign tests to ACE layers (atoms, molecules, organisms, e2e)
34
+
35
+ ### Execution Steps
36
+
37
+ - [ ] Create comprehensive test case structure using embedded template
38
+ - [ ] Generate test cases covering all identified scenarios
39
+ - [ ] Include implementation hints and examples
40
+ - [ ] Review and refine test cases for completeness
41
+ - [ ] Save test cases in appropriate project location
42
+
43
+ ## ACE Testing Framework
44
+
45
+ All ACE packages use Minitest with layer-specific conventions:
46
+
47
+ | Layer | Directory | IO Policy | Performance Target |
48
+ |-------|-----------|-----------|-------------------|
49
+ | Atoms | `test/atoms/` | **No IO** | <10ms (max 50ms) |
50
+ | Molecules | `test/molecules/` | **No IO** | <50ms (max 100ms) |
51
+ | Organisms | `test/organisms/` | **Mocked IO** | <100ms (max 200ms) |
52
+ | E2E | `test/e2e/TS-*/` | **Real IO** | <2s (max 5s) |
53
+
54
+ **All tests MUST inherit from the package test base class:**
55
+
56
+ ```ruby
57
+ # CORRECT: Has access to package helpers
58
+ class FeedbackExtractorTest < AceReviewTest
59
+ # Can use stub_prompt_path, shared temp dir, etc.
60
+ end
61
+
62
+ # INCORRECT: Missing package helpers
63
+ class FeedbackExtractorTest < Minitest::Test
64
+ # No access to stub_prompt_path
65
+ end
66
+ ```
67
+
68
+ ## Process Steps
69
+
70
+ 1. **Analyze Requirements:**
71
+ - Review the feature/task details:
72
+ - Business requirements and user stories
73
+ - Technical specifications
74
+ - Acceptance criteria
75
+ - Implementation approach
76
+ - Dependencies and integrations
77
+
78
+ - Identify testable components:
79
+ - Input validation rules
80
+ - Business logic flows
81
+ - Output expectations
82
+ - Error scenarios
83
+ - Performance requirements
84
+
85
+ 2. **Identify Test Scenarios:**
86
+
87
+ **Scenario Categories:**
88
+
89
+ **Happy Path (Core Functionality):**
90
+ - Standard expected usage
91
+ - Primary user workflows
92
+ - Common configurations
93
+ - Successful outcomes
94
+
95
+ **Edge Cases:**
96
+ - Boundary values (min/max)
97
+ - Empty or null inputs
98
+ - Special characters
99
+ - Large data sets
100
+ - Concurrent operations
101
+
102
+ **Error Conditions:**
103
+ - Invalid inputs
104
+ - Missing required data
105
+ - Service failures
106
+ - Network timeouts
107
+ - Permission denials
108
+
109
+ **Integration Points:**
110
+ - External API calls
111
+ - Database operations
112
+ - File system access
113
+ - Message queues
114
+ - Third-party services
115
+
116
+ 3. **Assign to ACE Test Layer:**
117
+
118
+ ### ACE Test Layer Assignment
119
+
120
+ | Layer | Directory | IO Policy | Performance Target |
121
+ |-------|-----------|-----------|-------------------|
122
+ | Atoms | `test/atoms/` | **No IO** | <10ms (max 50ms) |
123
+ | Molecules | `test/molecules/` | **No IO** | <50ms (max 100ms) |
124
+ | Organisms | `test/organisms/` | **Mocked IO** | <100ms (max 200ms) |
125
+ | E2E | `test/e2e/TS-*/` | **Real IO** | <2s (max 5s) |
126
+
127
+ **Layer Decision Matrix:**
128
+
129
+ | Test This... | At Layer | Because |
130
+ |-------------|----------|---------|
131
+ | Pure logic (input → output) | Atoms | No dependencies |
132
+ | Component composition | Molecules | Stubs external calls |
133
+ | Business workflows | Organisms | Mocked boundaries |
134
+ | CLI parity (ONE per file) | Organisms | Real subprocess |
135
+ | Critical user journeys | E2E | Full system validation |
136
+
137
+ 4. **Apply IO Isolation Requirements:**
138
+
139
+ **Atoms & Molecules (Unit Tests):**
140
+ - [ ] No filesystem operations (use temp dirs or mocks)
141
+ - [ ] No network calls (use WebMock)
142
+ - [ ] No subprocess calls (stub `Open3`, `system`, backticks)
143
+ - [ ] No real git operations (use MockGitRepo)
144
+ - [ ] No sleep calls (stub `Kernel.sleep`)
145
+
146
+ **Organisms (Integration):**
147
+ - [ ] External services stubbed
148
+ - [ ] ONE real CLI test per file maximum
149
+ - [ ] All other subprocess calls mocked
150
+
151
+ **Common Subprocess Patterns to Stub:**
152
+ | Pattern | Typical Cost | Standard Stub |
153
+ |---------|-------------|---------------|
154
+ | `` `ace-nav ...` `` | ~200ms | `stub_prompt_path(object)` |
155
+ | `` `git ...` `` | ~100ms | MockGitRepo or stub |
156
+ | `Open3.capture3` | ~150ms | Stub `:capture3` |
157
+
158
+ 5. **Create Test Case Structure:**
159
+
160
+ Use the test case template embedded below.
161
+
162
+ 6. **Generate Comprehensive Test Cases:**
163
+
164
+ **Example: Feedback Extraction Feature**
165
+
166
+ ```markdown
167
+ # Test Cases: Feedback Extraction
168
+
169
+ ## Atoms
170
+
171
+ ### TC-001: Extract File Path from Line
172
+ **Layer**: Atoms
173
+ **Priority**: High
174
+ **Component**: PatternAnalyzer
175
+ **Target**: <10ms
176
+
177
+ **Description**: Extract file path from review feedback line
178
+
179
+ **Test Steps**:
180
+ 1. Parse "src/foo.rb:42: warning: unused variable"
181
+ 2. Extract file path component
182
+
183
+ **Expected**: Returns "src/foo.rb"
184
+
185
+ ---
186
+
187
+ ### TC-002: Parse Feedback Severity
188
+ **Layer**: Atoms
189
+ **Priority**: High
190
+ **Component**: FeedbackParser
191
+ **Target**: <10ms
192
+
193
+ **Test Cases**:
194
+ | Input | Expected Severity | Expected Code |
195
+ |-------|-------------------|---------------|
196
+ | "error: missing method" | error | E001 |
197
+ | "warning: unused var" | warning | W001 |
198
+ | "info: style issue" | info | I001 |
199
+
200
+ ---
201
+
202
+ ## Molecules
203
+
204
+ ### TC-010: Extract Feedback from Review Output
205
+ **Layer**: Molecules
206
+ **Priority**: High
207
+ **Component**: FeedbackExtractor
208
+ **Target**: <50ms
209
+ **Stubs Required**: `stub_prompt_path(@extractor)`
210
+
211
+ **Description**: Parse review output and extract structured feedback
212
+
213
+ **Setup**:
214
+ ```ruby
215
+ stub_prompt_path(@extractor) # Stubs ace-nav subprocess
216
+ ```
217
+
218
+ **Test Steps**:
219
+ 1. Create extractor with mocked prompt path
220
+ 2. Call extract with review text
221
+ 3. Verify parsed feedback items
222
+
223
+ **Expected**:
224
+ - Returns array of FeedbackItem objects
225
+ - File paths correctly extracted
226
+ - Severity levels parsed
227
+
228
+ ---
229
+
230
+ ## Organisms
231
+
232
+ ### TC-020: Coordinate Multi-Model Review
233
+ **Layer**: Organisms
234
+ **Priority**: High
235
+ **Component**: ReviewOrchestrator
236
+ **Target**: <100ms
237
+ **Stubs Required**: Mock LLM, MockGitRepo
238
+
239
+ **Description**: Orchestrate review across multiple models
240
+
241
+ **Setup**:
242
+ ```ruby
243
+ mock_llm = Minitest::Mock.new
244
+ mock_llm.expect(:complete, response, [prompt])
245
+ ```
246
+
247
+ **Test Steps**:
248
+ 1. Create orchestrator with mocked LLM
249
+ 2. Submit diff for review
250
+ 3. Verify LLM called correctly
251
+ 4. Assert result.success?
252
+
253
+ **Expected**:
254
+ - LLM receives correct prompt
255
+ - Response properly parsed
256
+ - Result marked successful
257
+
258
+ ---
259
+
260
+ ## E2E
261
+
262
+ ### TC-030: Full Review Workflow
263
+ **Layer**: E2E
264
+ **Priority**: Medium
265
+ **Component**: CLI
266
+ **Target**: <2s
267
+ **Real IO**: Yes
268
+
269
+ **Description**: Complete review workflow from CLI invocation
270
+
271
+ **Prerequisites**:
272
+ - Git repository with staged changes
273
+ - ACE tools installed
274
+
275
+ **Test Steps**:
276
+ 1. Run `ace-review` on test repo
277
+ 2. Verify exit code is 0
278
+ 3. Check feedback file created
279
+ 4. Verify feedback content
280
+
281
+ **Expected**:
282
+ - Exit code: 0
283
+ - Feedback file: `.ace/review/feedback.json`
284
+ - Contains structured feedback
285
+ ```
286
+
287
+ 7. **Include Test Implementation Hints:**
288
+
289
+ **Atom test - pure logic, no IO:**
290
+ ```ruby
291
+ class PatternAnalyzerTest < AceLintTest
292
+ def test_extracts_file_path_from_line
293
+ line = "src/foo.rb:42: warning: unused variable"
294
+ result = PatternAnalyzer.extract_path(line)
295
+ assert_equal "src/foo.rb", result
296
+ end
297
+ end
298
+ ```
299
+
300
+ **Molecule test - stubs subprocess calls:**
301
+ ```ruby
302
+ class FeedbackExtractorTest < AceReviewTest
303
+ def setup
304
+ @extractor = FeedbackExtractor.new
305
+ stub_prompt_path(@extractor) # Stubs ace-nav subprocess
306
+ end
307
+
308
+ def test_extracts_feedback_from_review
309
+ result = @extractor.extract(review_text)
310
+ assert_equal 3, result.items.length
311
+ end
312
+ end
313
+ ```
314
+
315
+ **Organism test - mocked boundaries:**
316
+ ```ruby
317
+ class ReviewOrchestratorTest < AceReviewTest
318
+ def test_coordinates_multi_model_review
319
+ mock_llm = Minitest::Mock.new
320
+ mock_llm.expect(:complete, response, [prompt])
321
+
322
+ orchestrator = ReviewOrchestrator.new(llm: mock_llm)
323
+ result = orchestrator.review(diff)
324
+
325
+ assert result.success?
326
+ mock_llm.verify
327
+ end
328
+ end
329
+ ```
330
+
331
+ 8. **Verification:**
332
+
333
+ After creating test cases, validate with:
334
+
335
+ ```bash
336
+ # Verify tests meet performance targets
337
+ ace-test <package> --profile 10
338
+
339
+ # Full suite health check
340
+ ace-bundle wfi://test/verify-suite
341
+ ```
342
+
343
+ Expected:
344
+ - All atoms <50ms
345
+ - All molecules <100ms
346
+ - All organisms <200ms
347
+ - No unstubbed subprocess calls in unit tests
348
+
349
+ 9. **Review and Refine:**
350
+
351
+ **Test Case Review Checklist:**
352
+ - [ ] All requirements have corresponding tests
353
+ - [ ] Happy path scenarios covered
354
+ - [ ] Edge cases identified and tested
355
+ - [ ] Error conditions properly tested
356
+ - [ ] Test data is realistic
357
+ - [ ] Tests are independent
358
+ - [ ] Clear pass/fail criteria
359
+ - [ ] Appropriate layer chosen (atoms/molecules/organisms/e2e)
360
+ - [ ] IO isolation requirements met
361
+ - [ ] Performance targets achievable
362
+
363
+ 10. **Save Test Cases:**
364
+
365
+ **File Organization:**
366
+
367
+ Use the current release directory for test cases:
368
+
369
+ ```bash
370
+ # Get current release path
371
+ ace-release --path
372
+ ```
373
+
374
+ ```
375
+ .ace-taskflow/v.X.Y.Z/test-cases/
376
+ ├── feature-authentication-tests.md
377
+ ├── api-endpoint-tests.md
378
+ └── performance-benchmarks.md
379
+ ```
380
+
381
+ **Naming Convention:**
382
+ - `feature-[name]-tests.md` - Feature-specific tests
383
+ - `api-[endpoint]-tests.md` - API testing
384
+ - `security-[component]-tests.md` - Security tests
385
+ - `performance-[area]-tests.md` - Performance tests
386
+
387
+ ## Test Case Prioritization
388
+
389
+ **High Priority:**
390
+
391
+ - Core business logic
392
+ - Security-critical features
393
+ - User-facing functionality
394
+ - Data integrity operations
395
+
396
+ **Medium Priority:**
397
+
398
+ - Secondary features
399
+ - Admin functions
400
+ - Reporting features
401
+ - Performance optimizations
402
+
403
+ **Low Priority:**
404
+
405
+ - Nice-to-have features
406
+ - Cosmetic issues
407
+ - Rare edge cases
408
+ - Internal tools
409
+
410
+ ## Success Criteria
411
+
412
+ - Comprehensive test case list covering all requirements
413
+ - Tests organized by type and priority
414
+ - Each test has clear steps and expected results
415
+ - Test data and prerequisites documented
416
+ - Edge cases and error scenarios included
417
+ - Tests are atomic and independent
418
+ - Clear traceability to requirements
419
+
420
+ ## Common Testing Patterns
421
+
422
+ ### Boundary Testing
423
+
424
+ ```markdown
425
+ ### TC-030: Age Validation Boundaries
426
+ **Test Cases**:
427
+ - Age = -1 → Error (negative)
428
+ - Age = 0 → Valid (minimum)
429
+ - Age = 17 → Invalid (below minimum)
430
+ - Age = 18 → Valid (minimum adult)
431
+ - Age = 120 → Valid (maximum reasonable)
432
+ - Age = 121 → Warning (unusually high)
433
+ - Age = null → Error (required field)
434
+ ```
435
+
436
+ ### State Transition Testing
437
+
438
+ ```markdown
439
+ ### TC-040: Order State Transitions
440
+ **Valid Transitions**:
441
+ - Draft → Submitted → Approved → Fulfilled
442
+ - Draft → Cancelled
443
+ - Submitted → Rejected
444
+
445
+ **Invalid Transitions**:
446
+ - Fulfilled → Draft (cannot reverse)
447
+ - Cancelled → Approved (terminated state)
448
+ ```
449
+
450
+ ### Data Validation Matrix
451
+
452
+ ```markdown
453
+ ### TC-050: Input Validation
454
+ | Field | Valid Values | Invalid Values | Expected Error |
455
+ |-------|--------------|----------------|----------------|
456
+ | Email | user@domain.com | plaintext | Invalid format |
457
+ | Phone | +1-555-1234 | 12345 | Invalid format |
458
+ | Date | 2024-01-01 | 01-01-2024 | Invalid format |
459
+ ```
460
+
461
+ ## Common Patterns
462
+
463
+ ### Feature Test Case Development
464
+
465
+ Create comprehensive test suites when implementing new features with complex business logic.
466
+
467
+ ### API Endpoint Test Coverage
468
+
469
+ Develop test cases for REST API endpoints covering various HTTP methods and response scenarios.
470
+
471
+ ### Security Feature Testing
472
+
473
+ Generate security-focused test cases for authentication, authorization, and data protection features.
474
+
475
+ ### Performance Benchmark Testing
476
+
477
+ Create performance test cases to establish and maintain system performance standards.
478
+
479
+ ## Usage Example
480
+ >
481
+ > "I've implemented a new user registration feature with email verification. Create comprehensive test cases covering all aspects of the registration flow."
482
+
483
+ ---
484
+
485
+ This workflow ensures thorough test coverage through systematic identification and documentation of test scenarios across all testing levels.
486
+
487
+ <documents>
488
+ <template path="dev-handbook/templates/release-testing/test-case.template.md"># Test Cases: [Feature Name]
489
+
490
+ ## Test Case: [TC-001] [Descriptive Name]
491
+
492
+ **Layer**: [Atoms | Molecules | Organisms | E2E]
493
+ **Priority**: [High | Medium | Low]
494
+ **Component**: [Component/Module being tested]
495
+ **Target**: [<10ms | <50ms | <100ms | <2s]
496
+ **Stubs Required**: [List stubs needed for atoms/molecules/organisms]
497
+
498
+ ### Description
499
+
500
+ Brief explanation of what this test validates.
501
+
502
+ ### IO Isolation Checklist
503
+
504
+ - [ ] No filesystem operations (atoms/molecules)
505
+ - [ ] No network calls (atoms/molecules/organisms)
506
+ - [ ] No subprocess calls without stubs (atoms/molecules)
507
+ - [ ] No sleep calls (atoms/molecules)
508
+ - [ ] At most ONE real CLI call (organisms)
509
+
510
+ ### Prerequisites
511
+
512
+ - Required test data
513
+ - System state
514
+ - Configuration settings
515
+ - External dependencies
516
+
517
+ ### Test Steps
518
+
519
+ 1. [Action 1]
520
+ - Input: [Specific data/parameters]
521
+ - Action: [What to do]
522
+ 2. [Action 2]
523
+ - Input: [Specific data/parameters]
524
+ - Action: [What to do]
525
+ 3. [Verification]
526
+ - Check: [What to verify]
527
+
528
+ ### Expected Results
529
+
530
+ - [Expected outcome 1]
531
+ - [Expected outcome 2]
532
+ - [System state after test]
533
+
534
+ ### Actual Results
535
+
536
+ (To be filled during test execution)
537
+
538
+ - [ ] Pass
539
+ - [ ] Fail
540
+ - Notes:
541
+
542
+ ### Test Data
543
+
544
+ ```json
545
+ {
546
+ "input": "example",
547
+ "config": {
548
+ "setting": "value"
549
+ }
550
+ }
551
+ ```
552
+
553
+ ## ACE Minitest Implementation Examples
554
+
555
+ ### Atom Test Example
556
+
557
+ ```ruby
558
+ # test/atoms/pattern_analyzer_test.rb
559
+ class PatternAnalyzerTest < AceLintTest
560
+ def test_extracts_file_path_from_line
561
+ line = "src/foo.rb:42: warning: unused variable"
562
+ result = PatternAnalyzer.extract_path(line)
563
+ assert_equal "src/foo.rb", result
564
+ end
565
+
566
+ def test_returns_nil_for_invalid_line
567
+ result = PatternAnalyzer.extract_path("invalid line")
568
+ assert_nil result
569
+ end
570
+ end
571
+ ```
572
+
573
+ ### Molecule Test Example
574
+
575
+ ```ruby
576
+ # test/molecules/feedback_extractor_test.rb
577
+ class FeedbackExtractorTest < AceReviewTest
578
+ def setup
579
+ @extractor = FeedbackExtractor.new
580
+ stub_prompt_path(@extractor) # Stubs ace-nav subprocess
581
+ end
582
+
583
+ def test_extracts_feedback_from_review
584
+ review_text = "src/foo.rb:42: warning: unused variable"
585
+ result = @extractor.extract(review_text)
586
+
587
+ assert_equal 1, result.items.length
588
+ assert_equal "src/foo.rb", result.items.first.file
589
+ end
590
+
591
+ def test_handles_empty_review
592
+ result = @extractor.extract("")
593
+ assert_empty result.items
594
+ end
595
+ end
596
+ ```
597
+
598
+ ### Organism Test Example
599
+
600
+ ```ruby
601
+ # test/organisms/review_orchestrator_test.rb
602
+ class ReviewOrchestratorTest < AceReviewTest
603
+ def test_coordinates_multi_model_review
604
+ mock_llm = Minitest::Mock.new
605
+ mock_llm.expect(:complete, mock_response, [Hash])
606
+
607
+ orchestrator = ReviewOrchestrator.new(llm: mock_llm)
608
+ result = orchestrator.review(diff)
609
+
610
+ assert result.success?
611
+ mock_llm.verify
612
+ end
613
+
614
+ def test_handles_llm_failure_gracefully
615
+ mock_llm = Minitest::Mock.new
616
+ mock_llm.expect(:complete, nil) { raise StandardError }
617
+
618
+ orchestrator = ReviewOrchestrator.new(llm: mock_llm)
619
+ result = orchestrator.review(diff)
620
+
621
+ refute result.success?
622
+ assert result.error
623
+ end
624
+ end
625
+ ```
626
+
627
+ ### E2E Test Example
628
+
629
+ ```
630
+ <!-- test/e2e/TS-REVIEW-001-basic-workflow/ -->
631
+ scenario.yml # Metadata + setup (git-init, copy-fixtures, env)
632
+ TC-001-basic-review.tc.md
633
+ TC-002-missing-git-repo.tc.md
634
+ fixtures/
635
+ app.rb # def foo; end
636
+ ```
637
+
638
+ **TC-001-basic-review.tc.md:**
639
+ ```markdown
640
+ ---
641
+ tc-id: TC-001
642
+ title: Basic Review Workflow
643
+ ---
644
+
645
+ ## Objective
646
+
647
+ Verify that ace-review runs successfully and creates feedback output.
648
+
649
+ ## Steps
650
+
651
+ 1. Run review
652
+ ```bash
653
+ OUTPUT=$(ace-review 2>&1)
654
+ EXIT_CODE=$?
655
+ echo "Exit code: $EXIT_CODE"
656
+ ```
657
+
658
+ 2. Verify exit code
659
+ ```bash
660
+ [ "$EXIT_CODE" -eq 0 ] && echo "PASS: Exit code 0" || echo "FAIL: Expected 0, got $EXIT_CODE"
661
+ ```
662
+
663
+ 3. Verify feedback file created
664
+ ```bash
665
+ [ -f .ace/review/feedback.json ] && echo "PASS: Feedback file exists" || echo "FAIL: No feedback file"
666
+ ```
667
+
668
+ ## Expected
669
+
670
+ - Exit code: 0
671
+ - Feedback file created at .ace/review/feedback.json
672
+ ```
673
+
674
+ </template>
675
+ </documents>