Skip to content

Testing

aiserrock edited this page Jul 8, 2026 · 1 revision

Testing

Unit / Bloc Tests

Located in test/unit/, organized by layer (cubit/, formz/, service/, util/).

  • Framework: mocktail for mocking dependencies, bloc_test for cubit/bloc state assertions.
  • Mock external dependencies (repositories, services); never hit real network/DB in unit tests.
  • Run:
fvm flutter test

E2E Tests (Patrol)

Located in integration_test/ (e.g. app_smoke_test.dart), powered by Patrol.

  • Configured via the patrol: block in pubspec.yaml (app name, Android package, iOS bundle id per flavor).
  • Runs on a real/simulated device or emulator, exercising full app flows.
  • Run:
patrol test --flavor dev

Requirements

  • Every new feature must ship with corresponding unit/bloc tests, and E2E coverage for critical user flows.
  • Every bug fix must include a regression test that fails before the fix and passes after.
  • Prefer unit/bloc tests for logic; reserve Patrol E2E tests for flows that cross widget/navigation boundaries.

Clone this wiki locally