flutter-testing

Installation
SKILL.md

Flutter Testing Standards

Priority: P0 (CRITICAL)

Core Rules

  1. Test Pyramid: Unit > Widget > Integration.
  2. Naming: should <behavior> when <condition>.
  3. AAA: Arrange, Act, Assert in all tests.
  4. Shared Mocks: test/shared/ only — no local mocks.
  5. File Placement: _integration_test.dart ONLY in integration_test/.
  6. Robot-First: ALL UI assertions/interactions via Robot pattern (e.g., CheckoutRobot) — never raw find.*/expect() in test body.

Widget Testing & Mocking

  • Setup: Use TestWrapper.init() in setUpAll and tester.pumpLocalizedWidget(...).
  • Mocking: Use GetIt registration of Mock BLoCs in setUpAll if created internally. Use blocTest for BLoC logic and whenListen for state transitions.
  • Stubbing: Always stub bloc.state and bloc.stream in setUp. Prohibit any() / anyNamed().
  • Async: Use settle: false for loading or stream states to verify mid-process transitions.
Installs
6
GitHub Stars
521
First Seen
May 19, 2026
flutter-testing — hoangnguyen0403/agent-skills-standard