Tdd

TDD (Test-Driven Development)

jh941213 Updated 125 repo stars
세 터미널(Claude Code·Codex·Copilot CLI)이 의도·설계·계획·구현·검증·리뷰·출시·학습 여덟 단계의 무한 루프로 이어지는 그림

File contents

TDD (Test-Driven Development)

Applies TDD methodology: write tests first, then implement code.

TDD Cycle

RED -> GREEN -> REFACTOR -> REPEAT

RED:      Write a failing test
GREEN:    Write minimal code to pass the test
REFACTOR: Improve code (keeping tests passing)
REPEAT:   Next feature/scenario

Procedure

  1. Define Interface (SCAFFOLD)

    • Define types/interfaces first
    • Write function signatures
  2. Write Tests (RED)

    • Happy path
    • Edge cases (empty values, null, max values)
    • Error cases
  3. Run Tests - Confirm Failure

    npm test -- path/to/file.test.ts
    
  4. Minimal Implementation (GREEN)

    • Only enough code to pass the tests
  5. Refactor (REFACTOR)

    • Improve code while keeping tests passing
  6. Check Coverage

    npm test -- --coverage
    
    • Target: 80% or higher

Precautions

  • Write tests first (before implementation!)
  • Write only one test at a time
  • Always verify the test fails first
  • Write only minimal code

jh941213/my-cc-harness commit 1bd48981e6

Frequently asked questions

npx get-skill add jh941213/tdd-2