Tdd

Test-driven development — vertical red-green-refactor slices through public interfaces.

yugasun d7f2767 4 files · 4.3 KB Updated

File contents

TDD

Tests verify behavior through public interfaces, not implementation. Good tests survive refactors; bad tests break on rename.

See tests.md and mocking.md for examples.

Anti-pattern: horizontal slices

Don't write all tests then all code. One behavior: RED → GREEN → repeat.

Workflow

  1. Plan — read CONTEXT.md/ADRs. Confirm interface changes and behaviors to test with user.
  2. Tracer bullet — one test, one minimal implementation, passes.
  3. Loop — one test at a time; only code to pass current test; no speculation.
  4. Refactor — only when GREEN; see refactoring.md.

Per-cycle checklist

  • Describes behavior, not implementation
  • Uses public interface only
  • Minimal code for this test

yugasun/aiops/tree/main/skills/tdd commit d7f2767677

Frequently asked questions

npx skillmds@latest add yugasun/tdd