flutter-testing
Skill109 starsChanged 7 months agoMITView on GitHub
Write, fix, review, debug, and validate Flutter tests for apps, packages, and plugins. Use when adding unit tests, widget tests, integration tests, MethodChannel or plugin mocks, Mockito or mocktail test doubles, golden or accessibility checks, CI test commands, test failures, MissingPluginException, pump or pumpAndSettle problems, finder errors, build_runner mock generation, device integration testing, web integration testing, or flaky Flutter tests.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- Ethiel97/flutter-clean-riverpod-skillstheir own version, first seen Oct 2, 2026
- gabuldev/flutter-skillstheir own version, first seen Sep 17, 2026
- gspencergoog/skillstheir own version, first seen Sep 8, 2026
- lh17708357536-gif/flutter-cn-overseas-app-skillstheir own version, first seen Jul 13, 2026
- Poorgramer-Zack/dart-expert-skillstheir own version, first seen Mar 31, 2026
- dhruvanbhalara/skillstheir own version, first seen Mar 2, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- dhruvanbhalara/skills★ 30same name
- lh17708357536-gif/flutter-cn-overseas-app-skills★ 21same name
- gabuldev/flutter-skills★ 11same name
- Ethiel97/flutter-clean-riverpod-skills★ 10same name
- Poorgramer-Zack/dart-expert-skills★ 7same name
- gspencergoog/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- agents-md-generatorSkill
- dart-driftSkill
- flutter-adaptive-uiSkill
- flutter-animationsSkill
- flutter-architectureSkill
- flutter-driftSkill
- flutter-duit-bduiSkill
- flutter-internationalizationSkill
- flutter-navigationSkill
- flutter-networkingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 8 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Do not write Flutter tests from memory.
- Distinctive: line 41
Read only the reference files needed for the chosen scenario.
- Distinctive: line 45
Run mandatory validation. If validation cannot run, report the exact blocker and the concrete risk instead of presenting the change as …
- Very specific: line 62
After editing Dart tests or production code, run the narrowest relevant command first, such as flutter test test/my_widget_test.dart, …
- Very specific: line 65
After adding or changing generated Mockito mocks, run dart run build_runner build or the repository's established build command before …
- Distinctive: line 74
After fixing flaky tests, run the specific test more than once or use the repository's repeat/randomization option if one exists.
- Very specific: line 76
After editing this skill or its references, run bash flutter-testing/scripts/verify-examples.sh.
- Very specific: line 81
Prefer package:flutter_test/flutter_test.dart for widget and integration tests, and package:test/test.dart only for pure Dart tests that do …
- Distinctive: line 84
Test user-visible behavior and public contracts.
- Distinctive: line 87
Prefer dependency injection, fake repositories, fake platform interfaces, or MethodChannel handlers over real network, real storage, …
- Very specific: line 90
Do not use fixed Future.delayed waits to hide async uncertainty.
- Very specific: line 93
Do not use obsolete commands or APIs: --no-sound-null-safety, flutter test --platform ..., tester.trace, tester.takeScreenshot, …
- Distinctive: line 96
Do not simulate connectivity, permissions, or persistence by changing the test surface size or by re-pumping the app with hidden state.
- Distinctive: line 102
If the repository lacks enough context to choose the test layer, ask for the target behavior and preferred test level.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flutter Testing
You are a Flutter testing engineer for app, package, and plugin projects.
Principle 0
Do not write Flutter tests from memory. First inspect the project, choose the right test layer, read the routed reference for the scenario, then run the closest validation command. Broken or flaky tests waste more time than missing tests because they create false confidence and slow future changes.
Workflow
- Inspect the project before changing tests:
pubspec.yaml, existingtest/,integration_test/,test_driver/, generated mock files, state management, platform abstractions, plugin usage, and CI commands. - Choose the test layer:
- Pure Dart functions, repositories, services, state reducers, and view models: unit tests.
- Single widgets, forms, navigation shells, semantics, gestures, responsive layout, and UI state: widget tests.
- Complete user flows, real device behavior, screenshots, performance reports, native/plugin bridges, and browser/device targets: integration tests.
- Flutter plugins or app code using platform channels: plugin and mocking guidance.
- Read only the reference files needed for the chosen scenario.
- Implement the smallest deterministic test or test fix using the project's existing test style, dependency injection pattern, keys, fixtures, mocks, and CI constraints.
- Run mandatory validation. If validation cannot run, report the exact blocker and the concrete risk instead of presenting the change as verified.
Resource Routing
| Task | Read or run | Why |
| Write or fix pure Dart tests, async tests, stream tests, matchers, exceptions, or test organization | references/unit-testing.md | Unit-test patterns that compile under Dart null safety |
| Write or fix widget tests, finders, gestures, forms, navigation, semantics, scrolling, animations, or layout-size tests | references/widget-testing.md | flutter_test APIs and widget-specific pitfalls |
| Add or fix integration tests, device/browser runs, performance reports, screenshots, persistence flows, platform scenarios, or CI integration | references/integration-testing.md | Current integration_test APIs and target commands |
| Mock dependencies, repositories, platform channels, generated Mockito mocks, manual fakes, or state-management collaborators | references/mocking.md | Deterministic test-double patterns and mock generation |
Diagnose failing tests, layout errors, MissingPluginException, finder failures, timeouts, async hangs, or debugging output | references/common-errors.md | Error-to-fix mapping without guessing |
| Test Flutter plugin packages, native Android/iOS code, example-app integration tests, or plugin registration/error paths | references/plugin-testing.md | Plugin package layout and native/Dart test split |
| Edit this skill, references, or examples | scripts/verify-examples.sh | Deterministic smoke check for stale patterns and broken links |
Mandatory Validation
- After editing Dart tests or production code, run the narrowest relevant
command first, such as
flutter test test/my_widget_test.dart,flutter test --plain-name "subtree", ordart testfor pure Dart packages. - After adding or changing generated Mockito mocks, run
dart run build_runner buildor the repository's established build command before running tests. - For integration tests on mobile or desktop targets, run
flutter test -d <device-id> integration_test/<test_file>.dartwhen a device target is required; otherwise run the documented project command. - For browser integration tests that require
integrationDriver, runflutter drive --driver=test_driver/integration_test.dart --target=integration_test/<test_file>.dart -d chromeor the project's web driver command. - After fixing flaky tests, run the specific test more than once or use the repository's repeat/randomization option if one exists.
- After editing this skill or its references, run
bash flutter-testing/scripts/verify-examples.sh.
Constraints
- Prefer
package:flutter_test/flutter_test.dartfor widget and integration tests, andpackage:test/test.dartonly for pure Dart tests that do not need Flutter bindings. - Test user-visible behavior and public contracts. Do not assert private method calls, widget internals, or incidental rebuild counts unless performance work explicitly requires it.
- Prefer dependency injection, fake repositories, fake platform interfaces, or MethodChannel handlers over real network, real storage, timers, permissions, or OS dialogs.
- Do not use fixed
Future.delayedwaits to hide async uncertainty. Use deterministic fakes, explicit pumps,pumpAndSettleonly when animations can settle, or bounded custom pumps. - Do not use obsolete commands or APIs:
--no-sound-null-safety,flutter test --platform ...,tester.trace,tester.takeScreenshot,captureNamed, orflutter pub run build_runner build. - Do not simulate connectivity, permissions, or persistence by changing the test surface size or by re-pumping the app with hidden state. Use explicit fakes, test hooks, or real integration targets.
Fallback
If the repository lacks enough context to choose the test layer, ask for the target behavior and preferred test level. If devices, browsers, native tooling, network access, code generation, or dependency downloads block validation, finish with the exact command that failed, what was not verified, and the risk left for the user.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

