Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 2.59 KB

File metadata and controls

76 lines (55 loc) · 2.59 KB

Testing StackArr

Tests are evidence against an identified contract. New behavior starts with a failing test, and contract fixtures are reviewed artifacts rather than snapshots updated automatically after a failure.

Test tiers

Unit tests

Unit tests live beside Rust modules and cover domain logic without network or database dependencies.

cargo test --workspace --lib

Property tests

Release-name parsing and custom-format matching accept hostile, combinatorial input. Add proptest cases beside their unit suites and ensure failures persist the minimal reproducer. Property tests run as part of the workspace test gate.

Database and integration tests

Database tests use MariaDB 11.4 LTS and an isolated schema. Tests must create their own state and may not depend on ordering. NNTP integration tests use the published mock NNTP server rather than a live provider. The exact container command will be exposed by just test-integration during P1.

Compatibility and conformance tests

P2 introduces contracts/arr-v3/ with one directory per façade and client. Each fixture contains a sanitized request, the expected status and headers, and the expected JSON body. Dynamic IDs, ports, and timestamps are represented by explicit normalizers in fixture metadata; the structural diff is otherwise strict.

To add a golden file after the P2 harness lands:

  1. Capture traffic from the pinned reference application through the recording proxy.
  2. Remove credentials, tokens, personal paths, and user data.
  3. Add only the narrowest required normalizers.
  4. Replay against the reference application and confirm a zero diff.
  5. Replay against StackArr and keep the generated test red.
  6. Implement the endpoint, make the test green, and include the fixture diff in review.

just test-compat runs generated OpenAPI contract tests. just conformance replays golden traffic and reports path coverage once the harness exists.

End-to-end tests

The React UI uses Playwright in ui/e2e. Golden paths and key failure paths are required for GUI changes.

npm --prefix ui ci --no-audit --no-fund
npm --prefix ui run test:e2e

Container and live-client E2E tests must use disposable data and document every external prerequisite. They must never contain real credentials.

Mandatory Rust gate

cargo build --workspace
cargo fmt --all -- --check
cargo clippy --workspace --all-features -- -D warnings
cargo test --workspace --all-features

Coverage is a per-crate ratchet: a change may improve coverage but may not lower the checked-in baseline without an explicit, reviewed justification.