flutter-testing

Installation
SKILL.md

Testing Strategy

  • Test Pyramid: More unit and widget tests, fewer integration tests. Unit tests are fastest and cheapest.
  • Mirror Test Rule: 100% logic and widget coverage. No code without a test.
  • Mirror Organization: Test files MUST strictly mirror the lib/ directory structure and end with _test.dart.
  • Coverage Targets: Target 100% logic coverage for domain and bloc layers.
  • Test Independence: Each test MUST be independent. No shared mutable state between tests.

Widget Testing

  • Write widget tests for all major UI components.
  • Test user interactions and state changes.
  • Widget Keys: Use Key('feature_action_id') format on interactive widgets for test access.
  • Test Localization: Use AppLocalizations (context.l10n) in widget tests — no hardcoded strings.

Pattern-Based Testing

Adopt these three structural patterns to eliminate boilerplate, enforce complete coverage, and ensure consistency across the test suite. These are conventions — no external package dependency is required.

Related skills
Installs
112
GitHub Stars
18
First Seen
Mar 2, 2026