Testing
Write, review, and audit tests for Flutter projects using Clean Architecture + Riverpod. Use when writing unit tests, widget tests, golden tests, reviewing test quality, checking test coverage, creating mocks/spies, or testing Riverpod providers.From its SKILL.md
npx -y skills add launch52-ai/flutter-template --skill testingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.1 KB, 706 tokens by cl100k_base, as published. Nobody here has run it
Testing - Write & Review Tests
Write high-quality, maintainable tests following Clean Architecture patterns. Every test should clearly express intent and catch regressions without being brittle.
When to Use This Skill
- Writing new tests (unit, widget, golden, integration)
- Reviewing test code quality
- Setting up test infrastructure (helpers, mocks, spies)
- Testing Riverpod providers and notifiers
- Auditing test coverage
Quick Reference
Test Types
| Type | Purpose | When to Use |
|---|---|---|
| Unit | Isolated logic | Repositories, services, utils, providers |
| Widget | UI interactions | Screens, navigation |
| Golden | Visual regression | Layout, themes |
| Integration | Real implementations | Storage, cache, API flows |
Naming Conventions
| Type | Pattern | Example |
|---|---|---|
| File | {component}_test.dart | auth_repository_impl_test.dart |
| Test | test_{subject}_{scenario}_{expected} | test_signIn_withValidCredentials_returnsAuthResult |
| Factory | any{Type}() | anyEmail(), anyUserProfile() |
| SUT | makeSUT() | Creates System Under Test |
Commands
# Run all tests
flutter test
# Run with coverage
flutter test --coverage
# Run specific type
flutter test test/unit/
flutter test test/widget/
# Audit test coverage
dart run .claude/skills/testing/scripts/check.dart
# Generate missing test files
dart run .claude/skills/testing/scripts/check.dart --generate
# Update golden files
flutter test --update-goldens test/golden/
Workflow
1. Create Test File
Mirror source path: test/unit/features/{feature}/data/repositories/{name}_test.dart
2. Write Tests Using Patterns
See patterns-guide.md for:
- makeSUT() - Factory for System Under Test
- Spy Pattern - Track method calls
- Arrange-Act-Assert - Clear structure
- Disposal Testing - Verify cleanup
- Inbox Checklist - Infrastructure testing
3. Verify Coverage
dart run .claude/skills/testing/scripts/check.dart
Checklist
Structure:
- Uses
makeSUT()for consistent setup - Uses
any*()factories for test data - Clear Arrange-Act-Assert structure
Coverage:
- Tests success and error paths
- Verifies side effects (storage, API calls)
Quality:
- No hardcoded delays
- No flaky assertions
- Disposal tested
Coverage Expectations
| Component | Minimum |
|---|---|
| Repositories | 90%+ |
| Providers | 85%+ |
| Utils | 80%+ |
| Widgets | 60%+ |
Guides
| Guide | Use For |
|---|---|
| patterns-guide.md | Test patterns, helpers, spies |
| examples.md | Before/after examples |
Related Skills
/a11y- Accessibility tests (textContrastGuideline, etc.)
What ships with it: 14 files
179.4 KB alongside SKILL.md
reference/
- flutter_test_config.dart381 B
- golden/features/auth/presentation/screens/login_screen_golden_test.dart11.4 KB
- helpers/fakes.dart12.1 KB
- helpers/golden_helpers.dart8.0 KB
- helpers/mocks.dart4.7 KB
- helpers/pump_app.dart6.5 KB
- helpers/riverpod_helpers.dart5.1 KB
- helpers/test_helpers.dart4.8 KB
- unit/features/auth/data/repositories/auth_repository_impl_test.dart11.6 KB
- unit/features/auth/presentation/providers/auth_provider_test.dart11.3 KB
- widget/features/auth/presentation/screens/login_screen_test.dart9.5 KB
scripts/
- check.dart23.1 KB
- examples.md23.6 KB
- patterns-guide.md47.1 KB