Flutter test plan
When to use
Someone wants tests for a Flutter change, a failing test map, or a plan before writing tests.
Approval bar
- Prefix
flutteranddartwithfvmwhen.fvm/or.fvmrcexists. - Do not add goldens to a repo that does not already use them unless asked.
- Do not commit, push, or change CI config without an explicit yes.
- Do not record integration tests against production.
Sequence
- Detect toolchain:
fvm flutter --versionor report that FVM is missing. - Classify the change: pure Dart, widget, platform channel, navigation, network.
- Pick the cheapest layer that would catch the bug:
- Unit: logic, parsing, cubit/bloc
- Widget: UI state, semantics, callbacks
- Golden: only if the project already has golden tests
- Integration/
integration_test: multi-screen or platform plugin paths
- Name tests after behavior, not implementation.
- List exact commands, one per line.
Commands
fvm dart analyze
fvm flutter test
fvm flutter test test/path/to_test.dart
fvm flutter test --update-goldens # only when goldens already exist and the user asked
If the project has no FVM files, use flutter/dart and state that in the plan.
Output format
# Test plan
Toolchain: fvm | system flutter (reason)
Change under test: [one sentence]
## Tests to add
| Layer | File | Test name | Asserts |
| unit | | | |
| widget | | | |
## Commands
Commands the installer can run
(plain fenced list)
Out of scope
Goldens / integration / production data
## Failure
If you cannot see the source, ask for the file or a paste. Do not invent APIs that are not in the tree.