We employ a pyramid testing strategy to ensure reliability and velocity.
Pyramid:
- Unit Tests (Bottom): Fast, isolated, high coverage.
- Integration Tests (Middle): Verify component interactions.
- E2E Tests (Top): Verify full system behavior via LSP.
Unit tests should cover all public functions and complex private logic.
Principles:
- Isolation: Tests must not depend on external systems (filesystem, network).
- Speed: Tests must run per commit.
- Coverage: Aim for high branch coverage in core logic.
E2E tests verify the system from the user's perspective (LSP client).
Scope:
- LSP Lifecycle: Initialize, Shutdown, Exit.
- Diagnostics: Verify reporting of graph errors.
- Resilience: Verify recovery from invalid states.
Tools:
- Rust standard test framework with a mock LSP client.
We use cargo-llvm-cov to measure test effectiveness.
Running Coverage Locally:
-
Install:
cargo install cargo-llvm-cov -
Add component:
rustup component add llvm-tools-preview -
Generate report:
cargo llvm-cov --html open target/llvm-cov/html/index.html
CI/CD Pipeline:
Every PR includes a Cargo llvm-cov step. We strive for high coverage in core logic.
Derived from: ADR_PERF (Performance Logic)
Strategy:
Performance is critical for recursive graph validation. We use criterion for micro-benchmarks.
- Location:
benches/directory. - Targets: Critical paths in
corelogic (parsing, linting).
Running Benchmarks:
cargo benchGoals:
- Linting: < 50ms for typical workspaces.
- Graph Generation: Scalable to 1000+ nodes.