TDD & Stub-First Strategy
1. Stubbing Phase
- Create Structure: Files, classes, methods.
- Implement Stubs: Use
NotImplementedError,return None, or hardcoded values. - Docstrings: Add detailed docstrings describing future logic.
- E2E Test (Stub): Write an E2E test that asserts the hardcoded behavior.
- Example: asserting
discount == 100.0(stubbed value).
- Example: asserting
2. Implementation Phase
- Verify Stubs: Ensure E2E test passes on stubs.
- Replace Stubs: Implement real logic.
- Unit Tests: Add unit tests for specific methods and edge cases.
- Update E2E: Update E2E test to assert real behavior.
- Example: asserting
discount == 150.0(calculated value).
- Example: asserting
3. Testing Rules
- No Mocking LLMs: Use recorded responses or separate integration environments.
- Regression: Always run full regression suite.