Test A Flutter App
Use many cheap tests and a few target-realistic tests.
Test Mix
| Test type | Use for | Command |
|---|---|---|
| Unit | Models, repositories, view models, parsing, policy logic | flutter test test/... |
| Widget | Rendering, interactions, accessibility guidelines | flutter test test/... |
| Integration | Full app flows on device, emulator, desktop, or browser | flutter test integration_test or flutter drive path |
| Native interaction | Permission dialogs, notifications, platform views | Patrol or platform-specific test path |
| Manual smoke | Store builds, screen readers, real devices | Recorded checklist |
Layered Example
test/features/notes/notes_view_model_test.dart
test/features/notes/notes_view_test.dart
integration_test/app_smoke_test.dart
Keep plugin access behind fakes so unit and widget tests do not need native runtime setup.
What integration_test Does Not Prove
The official docs call out native UI gaps. If a flow depends on OS permission dialogs, notifications, or platform views, add a native-aware route such as Patrol or manual device smoke.
Gotcha: A widget test can prove your Flutter UI reacts correctly. It cannot prove Android permission policy, iOS capabilities, or desktop packaging.