BMAD-METHOD/examples/tdd-demo-calculator/README.md

3.3 KiB

BMAD TDD Demo - Calculator Project

This is a complete working demonstration of the BMAD TDD Methodology Expansion Pack using a simple calculator project.

🎯 Project Overview

Purpose: Demonstrate a complete Red-Green-Refactor TDD cycle using BMAD methodology
Result: Successfully implemented with 100% test coverage
Rating: 9.5/10 framework integration score

📊 Results Summary

  • 21 test cases covering all acceptance criteria
  • 100% code coverage (exceeds 90% target)
  • Complete TDD cycle from Red → Green → Refactor
  • Full documentation of TDD progression in story file
  • Performance requirements met (< 1ms per operation)

🗂️ Project Structure

├── src/
│   └── calculator.js          # Implementation (post-refactor)
├── tests/
│   └── calculator.test.js     # Comprehensive test suite
├── stories/
│   └── 1.1-calculator-basic-operations.md  # Complete story with TDD progression
├── package.json               # Jest configuration and dependencies
└── TDD_EVALUATION_REPORT.md   # Detailed evaluation findings

🚀 Quick Start

  1. Install dependencies:

    npm install
    
  2. Run tests:

    npm test
    
  3. Check coverage:

    npm run test:coverage
    

📋 Story Progression

The complete TDD cycle is documented in the story file:

Red Phase

  • 21 failing tests written first
  • Clear Given-When-Then structure
  • Proper test isolation and mocking strategy
  • Tests fail for correct reasons (no implementation)

Green Phase

  • Minimal implementation to make tests pass
  • All acceptance criteria satisfied
  • 100% test coverage achieved
  • Performance requirements met

Refactor Phase

  • Code quality improvements while maintaining green tests
  • Extracted helper methods and constants
  • Improved readability and maintainability
  • Zero functionality changes

🧪 Test Quality

  • Deterministic: No random values or external dependencies
  • Isolated: Each test runs independently
  • Fast: All tests complete in < 200ms total
  • Readable: Clear test names and Given-When-Then structure
  • Comprehensive: Edge cases and error conditions covered

📖 Key BMAD TDD Features Demonstrated

  1. Story Template Integration - TDD metadata seamlessly integrated
  2. Agent Workflow - QA agent Red phase, Dev agent Green phase
  3. Quality Gates - Phase-specific validation and progression
  4. Documentation - Complete traceability through story file
  5. Commands - TDD commands integrated with BMAD workflow

🎯 Evaluation Highlights

  • Integration: 10/10 - Seamless with existing BMAD framework
  • Documentation: 10/10 - Excellent story progression tracking
  • TDD Process: 10/10 - Complete Red-Green-Refactor cycle
  • Code Quality: 9/10 - Clean, maintainable, well-tested code
  • Framework Value: 9/10 - Significant enhancement to BMAD

📚 Learn More

  • See TDD_EVALUATION_REPORT.md for detailed evaluation findings
  • Review stories/1.1-calculator-basic-operations.md for complete TDD progression
  • Check the expansion pack documentation in ../../expansion-packs/tdd-methodology/

Status: Production Ready
Framework: BMAD-METHOD™ TDD Expansion Pack
Evaluation: Complete with 9.5/10 rating