Skip to content

v1.0.9: Testing Strategy

Choose a tag to compare

@khgs2411 khgs2411 released this 02 Oct 10:58
· 176 commits to master since this release

🧪 Testing Strategy Section - Respect User's Testing Methodology

CRITICAL FIX: Prevents AI from creating test files that violate your conventions.

The Problem

Real-world scenario from RED project development:

User uses per-service simulation testing (scripts/{service}.scripts.ts pattern). AI implemented a feature and created test.blue.validation.ts, violating:

  • ❌ Naming convention ({service}.scripts.ts NOT test.{service}.*.ts)
  • ❌ File placement (should be in scripts/ directory)
  • ❌ Testing methodology (should create blue.scripts.ts or add to existing)

User's feedback:

"why did you create a new test.blue.validation script? its not within the scope of our simulation framework, nor does meet our naming convention and file placement"

Key Insight

It's OK for AI to create NEW test files - just follow YOUR pattern!

The issue isn't "creating files", it's "violating conventions".

What user DOESN'T want:

  • ❌ Creating test.blue.validation.ts (wrong naming: test.*.ts)
  • ❌ Wrong location (random placement vs scripts/ directory)

What user DOES want:

  • ✅ Creating scripts/gold.scripts.ts for new "gold" service (follows {service}.scripts.ts pattern!)
  • ✅ Adding to scripts/blue.scripts.ts if file already exists (enhancement, not new feature)

The Solution

Testing Strategy section in PLAN.md now includes:

  1. Methodology: How you test (simulation, unit tests, TDD, integration, manual QA)
  2. Location: Where test files live (scripts/, __tests__/, e2e/, etc.)
  3. Naming Convention: Test file pattern ({service}.scripts.ts, {feature}.test.ts, etc.)
  4. When to create: When to create NEW test files (e.g., "new service = new file")
  5. When to add: When to add to existing files (e.g., "enhancement = add to existing")
  6. Tooling: What you use (Jest, Vitest, Bun, custom scripts)

Changes

/flow-blueprint Enhanced - 3 Critical Questions

4. Gather testing methodology (CRITICAL):
   - Ask about testing approach (6 common options)
   - CRITICAL follow-up questions:
     * "What's your test file naming convention?"
     * "Where do test files live?"
     * "When should I create NEW test files vs. add to existing?"
   
6. Generate Testing Strategy section (REQUIRED):
   - Must include: Methodology, Location, Naming Convention, When to create, When to add
   - Include file structure example
   - Add IMPORTANT section with ✅ DO and ❌ DO NOT examples

DEVELOPMENT_FRAMEWORK.md - Complete Rewrite

Example 1 - Per-Service Simulation (like RED project):

## Testing Strategy

**Methodology**: Simulation-based orchestration per service

**Approach**:
- Each service has its own orchestration file: scripts/{service}.scripts.ts
- **Naming Convention**: {service}.scripts.ts (blue.scripts.ts, green.scripts.ts, red.scripts.ts)
- **Location**: scripts/ directory
- **When to create**: If scripts/{service}.scripts.ts doesn't exist for new service, create it
- **When to add**: If file exists, add new test cases to existing orchestration

**File Structure**:
scripts/
├── run.scripts.ts        # Main orchestration
├── blue.scripts.ts       # Blue service tests
├── green.scripts.ts      # Green service tests
├── red.scripts.ts        # Red service tests
└── gold.scripts.ts       # Gold service tests (create if new service)

**IMPORTANT**:
- ❌ Do NOT create test.{service}.*.ts files (wrong naming pattern)
- ❌ Do NOT create files outside scripts/ directory (wrong location)
- ✅ DO follow {service}.scripts.ts pattern exactly
- ✅ DO create new {service}.scripts.ts for new services

Example 2 - Unit Tests After Implementation:

## Testing Strategy

**Methodology**: Unit tests after implementation using Jest

**Approach**:
- **Naming Convention**: {feature}.test.ts (payment-gateway.test.ts)
- **Location**: __tests__/ directory
- **When to create**: After iteration implementation complete, if feature is new
- **When to add**: If feature already has test file, add new test cases

**IMPORTANT**:
- ✅ Create __tests__/new-feature.test.ts for new features
- ✅ Add test cases to __tests__/existing-feature.test.ts for enhancements
- ❌ Do NOT create tests before implementation (we're not doing TDD)

/flow-implement_start Enhanced

3. Read Testing Strategy section (CRITICAL):
   - Understand verification methodology
   - Note naming convention, location, when to create vs. add
   - IMPORTANT: Follow Testing Strategy exactly - do NOT violate conventions

EXAMPLE_PLAN.md - Enhanced Example

Added to Testing Strategy section:

  • When to create and When to add fields
  • File Structure showing test file organization
  • IMPORTANT section with ✅ DO and ❌ DO NOT examples

Real-World Usage

Your RED project setup:

## Testing Strategy

**Methodology**: Simulation-based orchestration per service
**Naming Convention**: {service}.scripts.ts
**Location**: scripts/ directory
**When to create**: If scripts/{service}.scripts.ts doesn't exist for new service
**When to add**: If file exists, add test cases to existing file

AI behavior during implementation:

  • Working on new "gold" service → ✅ Creates scripts/gold.scripts.ts (follows pattern!)
  • Working on blue enhancement → ✅ Adds to scripts/blue.scripts.ts (file exists)
  • ❌ NEVER creates test.blue.validation.ts (violates naming convention)

Result: AI respects your workflow! 🎯

Files Changed

  • framework/SLASH_COMMANDS.md (+enhanced /flow-blueprint with 3 critical questions, /flow-implement_start with convention checking)
  • framework/DEVELOPMENT_FRAMEWORK.md (+2 detailed examples showing "when to create" vs "when to add", clarified language)
  • framework/EXAMPLE_PLAN.md (+when to create/add fields, file structure example, DO/DON'T section)
  • flow.sh (rebuilt: 127KB, 3964 lines)

Total: ~422 additions, ~18 deletions across 4 files

Impact

Before v1.0.9:

  • AI assumed generic testing approach
  • Created test files violating user conventions
  • User had to manually fix/delete unwanted files

After v1.0.9:

  • AI asks 3 critical questions about testing upfront
  • Testing Strategy documents naming, location, when to create vs. add
  • AI follows YOUR pattern exactly (creates new files when appropriate, adds to existing when appropriate)
  • No more convention violations!

Testing Strategy = Single source of truth for verification methodology ✨