Testing Strategy
This project uses layered tests with explicit coverage gates.
Layers
- Unit + component (
cargo test --bin afhttp)
- Focus: parser/config/body logic, request handlers, websocket/chunked event sequencing.
- Style: table-driven inputs + boundary values + event-order assertions.
- End-to-end stress (
tests/stress.py,tests/cli_stress.py,tests/ws_stress.py)
- Focus: real process behavior, request/response protocol, streaming and websocket integration.
- Note: test ports are configurable via
AFH_TEST_HTTP_PORTandAFH_TEST_WS_PORT. - Dependency:
tests/ws_stress.pyrequires Python packagewebsockets.
- Coverage gate (
scripts/coverage_gate.py)
- Runs
cargo llvm-cov --all-targets. - Enforces thresholds from
coverage-policy.json. - Core files are gated separately; exempt files are tracked but not blocking.
Defect-driven regression policy
Every production bug fix must include a regression test.
- Required regression tests are listed in
tests/regressions.txt. scripts/check_regressions.shfails if any listed test is missing.
Commands
Run all quality gates:
./scripts/test.sh
Run specific tiers:
./scripts/test.sh static
./scripts/test.sh unit
./scripts/test.sh e2e
./scripts/test.sh coverage