testing

Featured

Best practices for Dart unit tests, Flutter widget tests, and golden file tests, covering descriptive group and test naming, setUp lifecycle and test isolation, mocking and verification with package:mocktail, the shared pumpApp test helper, finders and widget interactions. Use when writing, modifying, or reviewing tests that use package:test, package:flutter_test, package:mocktail, or package:bloc_test.

Testing & QA 161 stars 22 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
74
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Dart & Flutter Testing Testing fundamentals for Dart and Flutter projects — unit tests, widget tests, and golden file tests — using `package:test`, `package:flutter_test`, `package:mocktail`, and `package:bloc_test`. ## Core Standards Apply these standards to ALL test work: - **Descriptive test names** — verbose, readable names that describe the behavior; never `'works'` or `'renders'` - **Hierarchical group/test structure that reads as natural sentences** — top-level `group` for the class, nested `group` for the method, `test` for the behavior (e.g., `UserRepository` → `getUser` → `returns User when API succeeds`) - **String interpolation for type references** — use `'returns $User'` not `'returns User'` so renames propagate automatically - **Private mocks per file** — declare `class _MockX extends Mock implements X {}` with underscore prefix to prevent cross-file coupling - **Contained test setup within groups** — all `setUp`/`tearDown` calls live inside a `group`, never at the top level of `main()` - **Initialize mutable objects in `setUp()` with `late`** — declare `late MyDep dep;` then assign in `setUp` so each test gets a fresh instance - **No shared mutable state between tests** — never use static members, global variables, or top-level final instances that persist across tests - **Use `package:mocktail`** — never `package:mockito` - **Constant test tags** — use an `abstract class TestTag` with `static const` fields; never pass raw string literals as tags - **Tes...

Details

Author
VeryGoodOpenSource
Repository
VeryGoodOpenSource/vgv-ai-flutter-plugin
Created
6 months ago
Last Updated
yesterday
Language
Shell
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category