# Testing Standards & Fixtures

This document dictates the specific testing implementation standards for GramPilot.

## 1. Hermetic Testing & Mocks
- **No Sleep:** Never use `time.sleep()` in unit tests. Time-based flakiness is unacceptable. Mock the clock or the `random_sleep` function.
- **Centralized Stubs:** If a test does not explicitly test the `SituationalAwarenessEngine` (SAE), the SAE must be stubbed via `conftest.py` (`mock_sae_perceive`) to return `SituationType.NORMAL`. This prevents E2E logic tests (like swiping logic) from failing due to missing local Ollama/Qdrant instances.

## 2. UI Dumps as Truth
- **No Synthetic XML:** You must never write synthetic or "guessed" XML strings for tests.
- **Real Fixtures:** All tests involving perception must use real-world XML dumps extracted from physical devices. Store them in `tests/fixtures/` and sync them using `scripts/sync_fixtures.py`.

## 3. Coverage
- **100% Pass Rate:** The build is considered broken if a single test fails.
- **Test Categories:**
  - `tests/e2e/`: Full end-to-end navigational sequences.
  - `tests/anomalies/`: Edge cases (e.g., action blocks, network drops).
  - `tests/property/`: Property-based invariants (e.g., ensuring swipe physics never go out of bounds).
