# BMAD Test Framework

Automated testing system for BMAD agents using direct command execution.

## Quick Start

### Running the Test

**NOTE: Works only using:**

- Windsurf IDE with Gemini 2.5 Pro (uses 2 credits only)
- Cursor IDE with claude-4-sonnet or better

_Ensure to continue when LLM stops after too many calls._

**For LLMs, use this prompt:**

```
Execute the BMAD test in /Users/smian/github-ck/bmad-enhanced/tools/bmad-test-framework/basic-validation-test-yolo.md

Do not analyze or explain. Only execute the commands in sequence.
```

**Alternative for reading the test file:**

```bash
# Read the test file (if you want to see the contents first):
Read tools/bmad-test-framework/basic-validation-test-yolo.md
```

The test automatically:

- Creates a timestamped test workspace
- Executes all BMAD commands in sequence
- Stores outputs in `reference-outputs/test-run-[TIMESTAMP]/docs/`
- Runs comprehensive validation at the end
- Generates a quality report with 185-point assessment

### Test Output Location

All test outputs are isolated in:

```
tools/bmad-test-framework/reference-outputs/test-run-[TIMESTAMP]/
├── docs/
│   ├── project-brief.md
│   ├── market-research.md
│   ├── competitor-analysis.md
│   ├── prd.md
│   ├── architecture.md
│   └── stories/
└── validation-report.md
```

## Available Tests

### basic-validation-test-yolo.md ⭐ RECOMMENDED

- **Purpose**: Complete BMAD validation with workspace isolation and quality analysis
- **Duration**: 25-30 minutes (includes comprehensive validation)
- **Coverage**: All 5 core agents, document generation, story creation, quality validation
- **Features**: Automatic workspace creation, minimal user input, automatic validation report

### comprehensive-validation.md

- **Purpose**: Quality analysis of generated documents (automatically run in YOLO test)
- **Duration**: 10-15 minutes
- **Coverage**: 185-point professional standards assessment
- **Note**: Automatically executed at the end of basic-validation-test-yolo.md

## Troubleshooting

### LLM Not Executing Commands?

If the LLM analyzes the test file instead of executing:

1. Use explicit execution prompt:

   ```
   Execute the BMAD test in basic-validation-test-yolo.md
   Do not analyze. Only execute commands sequentially.
   ```

2. Force execution mode:
   ```
   ROLE: BMAD_TEST_EXECUTOR
   ACTION: Run each step in the test file
   BEGIN IMMEDIATELY
   ```

### Outputs in Wrong Directory?

The test includes workspace creation. If documents appear in main `docs/`:

- Check that Step 0 (workspace creation) executes properly
- Verify the test is running from the created workspace
- Ensure all commands execute in sequence

### Common Issues

**"Command not recognized"**

- Ensure commands start with `*` (asterisk)
- Example: `*agent analyst`, `*yolo`

**"Template not found"**

- Use exact template names: `*create-doc prd-tmpl`
- Don't add extensions or modify names

**"Context lost between agents"**

- Reference previous documents: "Use TaskFlow Pro from above"
- YOLO mode should maintain context automatically

## Manual Testing Examples

### Quick Agent Test Commands

```bash
# Initialize BMAD
Read bmad-core/agents/bmad-orchestrator.md
*yolo

# Test Analyst
*agent analyst
*create-doc project-brief-tmpl
# Provide: "MedConnect - Healthcare platform with telemedicine, HIPAA compliance"

# Test PM
*agent pm
*create-doc prd-tmpl
# Provide: "Reference MedConnect above, MVP with video consults, EHR integration"

# Test Architect
*agent architect
*create-doc architecture-tmpl
# Provide: "Microservices, AWS, 10k concurrent video sessions"

# Test PO
*agent po
*execute-checklist po-master-checklist
*shard-doc docs/prd.md

# Test SM
*agent sm
*create
# Respond: "Yes, create story 1.1"

# Test Workflow
*workflow greenfield-fullstack
# Provide: "LearnPath - AI-powered K-12 learning platform"
```

### Rich Context Examples

**For Healthcare Project (MedConnect):**

```
Project: MedConnect
Description: Comprehensive healthcare platform with telemedicine capabilities
Target Market: Healthcare providers and patients (B2B2C)
Key Features: Video consultations, EHR integration, appointment scheduling
Compliance: HIPAA, HITECH, state medical licensing
Technical: 10k concurrent video sessions, 99.9% uptime SLA
```

**For Education Project (LearnPath):**

```
Project: LearnPath
Description: AI-powered online learning platform for K-12 students
Key Features: Personalized learning paths, real-time progress tracking, gamification
Target Users: Students, teachers, parents, school administrators
Scale: 100k concurrent users, 1M total students
```

**For E-commerce Project (ShopSmart):**

```
Project: ShopSmart
Description: AI-driven e-commerce marketplace with predictive recommendations
Key Features: Smart product discovery, AR try-on, social shopping
Market: Gen Z and millennials, mobile-first experience
Technical: Real-time inventory, <200ms search response
```

## Test Validation

After running tests, validate quality:

```bash
# Check test outputs
ls -la tools/bmad-test-framework/reference-outputs/test-run-*/docs/

# Run quality validation
Read tools/bmad-test-framework/comprehensive-validation.md
```

## File Structure

```
tools/bmad-test-framework/
├── README.md                       # This file (includes manual test examples)
├── basic-validation-test-yolo.md   # Automated test with workspace isolation
├── comprehensive-validation.md     # Quality analyzer
├── reference-outputs/              # Test results
│   └── test-run-[TIMESTAMP]/      # Isolated test outputs
└── archive/                       # Legacy files
```

---

**Note**: BMAD tests validate documentation generation and agent coordination. For code implementation testing, use the Dev agent separately.
