/testing-patterns
internalWhat it is
Red-Green-Refactor TDD cycle, Arrange-Act-Assert unit test structure, integration test isolation patterns, and test doubles (stub, mock, spy, fake). This is the primary source of the TDD methodology used by /gaia-dev-story.
Called by
/gaia-dev-story(TDD phases)- All six stack dev agents
What it does
Defines the TDD cycle: write a failing test (Red), write minimum code to pass (Green), improve code while keeping tests green (Refactor).
Documents the test pyramid: 70% unit tests, 20% integration tests, 10% E2E tests.
Provides Arrange-Act-Assert structure for unit tests and integration test isolation patterns.
Defines test double types and when to use each: stubs for simple returns, mocks for behavior verification, spies for call tracking, fakes for complex simulations.
When you will see it surface
- When
/gaia-dev-storyruns the TDD phases (Red, Green, Refactor), it follows the cycle defined here.
Technical notes
- Never write production code without a failing test.
- Write only enough test to fail, only enough code to pass.
- Refactor only when all tests are green.