Skip to main content

Testing

One command

./tool/test_all.sh
# → dart format --set-exit-if-changed .
# → flutter analyze
# → flutter test
# → golden diff (with CI image regeneration guidance)

Separate headful:

flutter test test/design_system --reporter expanded
flutter test integration_test/app_test.dart -d chrome

Pyramidal breakdown

LayerWhereWhat
Unit (exhaustive)test/unit/**, test/core/**, test/design_system/*_test.dartlifecycle vectors, deadline boundary, contest graphemes 10/2000, namespace mapping, token scales, contrast
Widgettest/widget/**, test/features/*/presentation/*, test/foundation/**, test/router/**hub selector/tab/banner, charge detail field visibility, contest disabled/enabled, keyboard (Enter/Space), focus ring, semantics heading/button/liveRegion, 360–1440 no overflow, RTL, light/dark
Goldentest/golden/** (10 design baselines + hub/charge variants)pixel proof of KxBanner, KxCard, KxPhotoStrip, etc. Harness pins DPR 1.0, surface, NoSplash. Linux CI must regenerate once (wave 2 vs Linux rasterization delta)
Architecturetest/architecture/**dependency cycle forbids: design_system no feature import, features no ad-hoc Navigator
Contracttest/helpers + test/router/…_test.dartfixture manifest hash check, router table vs KxRoutes, l10n parity
Integrationintegration_test/app_test.dartfixture boot → hub → inspection → charge → contest → history → statement → pay → reload persistence; uses integration_test + WebDriver

Determinism tactics

  • AppConfig.fixtureDefaults() avoids env; ManualClock-equivalent supplied via AnchoredDemoClock at fixed instant for deadline widget tests.
  • GetIt reset per setUp/tearDown to isolate DI.
  • No print — logs go via maybeLog* and are asserted via test prints matcher only where explicitly expected.

Goldens

Deterministic harness in test/golden/support/golden_harness.dart wraps each component with MediaQueryData(size, textScaler, brightness, disableAnimations) + Directionality. Failure message points at flutter test --update金? Use flutter test --update-goldens on pinned image (netlify.toml toolchain) and visually inspect before commit.

Evidence

tool/aggregate_evidence.dart and tool/check_evidence.dart validate docs/evidence/manifest.yaml SHA hashes; tool/android_runtime_proof.sh captures adb logcat + instrumentation for device proof. Part 8B must collect final evidence post-Part 7 merges (ADRs in docs/adr/).

What is not tested headlessly

Browser zoom, TalkBack/native screen reader announcement order, hosted SPA fallback — manual runtime per parts_plan.md §12 evidence ledger.

Coverage aspiration

Frontend has no hard coverage floor (unlike backend 85% branch) but every P0/P1 ID must map to at least one automated or manual evidence row before delivery — see ledger in plan.md §3.