Testing Strategy
The testing pyramid, adapter mocks, and system robustness.
Testing Strategy
We guarantee system reliability through rigorous automated testing. Our approach emphasizes high developer confidence, rapid execution speed, and comprehensive behavioral verification.
The Test Pyramid
We categorize our tests into three distinct layers to balance execution time with system coverage.
1. Fast Domain Tests (Unit Tests)
Unit tests form the massive base of our pyramid. They provide instant feedback during development by executing in milliseconds.
- Focus: They verify our pure Domain logic (the center of our Hexagonal Architecture).
- In-Memory Execution: Unit tests run entirely in-memory to maintain their speed.
- Boundary Mocks: We utilize mocks for our boundary Ports, ensuring our business logic is validated in perfect isolation from external infrastructure.
2. Infrastructure Tests (Adapter & Contract Tests)
Integration tests verify that our code communicates beautifully with the outside world.
- Focus: They validate the Adapters (database repositories, third-party API clients).
- Real Infrastructure: They use tools like ephemeral Docker containers to test queries and payload serialization against real, running instances of databases and queues.
- Robust Mapping: We ensure that low-level infrastructure errors meticulously map to explicit domain errors.
3. Cohesive Workflows (System & Smoke Tests)
System tests ensure that the entirety of WordLoop functions coherently across all microservice boundaries.
- Focus: They traverse the entire end-to-end path spanning the UI, API gateways, ML pipelines, and databases.
- Deployed Environments: These tests execute against fully deployed or Docker-composed environments to validate true system behavior.
- Systematic Validation: They confirm complete business flows (e.g., executing a foundational multi-step user journey from end to end).
- Event-Driven Verification: We utilize robust polling mechanisms and explicit readiness gates to reliably verify asynchronous workflows.
- Health Verification: We use subset smoke tests as high-speed sanity checks to guarantee newly deployed infrastructure routes traffic successfully.
Designing Tests as Documentation
Tests serve as executable documentation for the system's capabilities. We craft our test suites to clearly explain business rules, edge cases, and architectural boundaries to any engineer exploring the codebase.