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
domainandbloclayers. - Test Independence: Each test MUST be independent. No shared mutable state between tests.
Test Types Overview
| Type | Scope | Speed | Skill |
|---|---|---|---|
| Unit | Single function/class | Fast | dart-testing |
| Widget | Single UI component | Medium | flutter-add-widget-test |
| Integration | Full app / user flow | Slow | flutter-add-integration-test |
Pattern-Based Testing
These three patterns cut repetitive test setup, cover all visual states, and keep widget behavior consistent. They're conventions, not packages.