testing

Featured

Use when writing or reviewing Flutter/Dart tests (unit, widget, golden), fixing flaky tests, adding coverage, or choosing between unit and widget tests.

Testing & QA 619 stars 60 forks Updated today MIT

Install

View on GitHub

Quality Score: 95/100

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

Skill Content

# Testing Skill Write effective, meaningful Flutter and Dart tests that catch real regressions. ## When to Use Use this skill when: * Writing unit tests for business logic, repositories, or utility classes. * Writing widget tests for UI components. * Reviewing existing tests for correctness and coverage. * Fixing flaky or false-positive tests. * Deciding between unit tests, widget tests, and integration tests. --- ## 1. Test Validity Before writing or accepting a test, ask: > **"Can this test actually fail if the real code is broken?"** - Avoid tests that only confirm mocked/fake behavior without exercising real logic. - Avoid tests that confirm behavior guaranteed by the language or standard library. - Every test must be capable of catching a real regression. ```dart // BAD — tests the mock, not real logic test('should return user', () { when(() => repo.getUser()).thenReturn(fakeUser); expect(repo.getUser(), fakeUser); // Only proves the mock works }); // GOOD — tests the cubit's state transitions driven by the mock blocTest<UserCubit, UserState>( 'should emit loaded state when getUser succeeds', build: () { when(() => repo.getUser()).thenAnswer((_) async => fakeUser); return UserCubit(repo); }, act: (cubit) => cubit.fetchUser(), expect: () => [ const UserState(status: UserStatus.loading), UserState(status: UserStatus.loaded, user: fakeUser), ], ); ``` --- ## 2. Structure Always use `group()` in test files. Name the group after t...

Details

Author
evanca
Repository
evanca/flutter-ai-rules
Created
1 years ago
Last Updated
today
Language
Shell
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Listed

flutter-testing

Design, write, or review Flutter unit, widget, golden, and integration tests. Use for test strategy, regressions, fakes, async UI behavior, and end-to-end flows; use device testing for operational emulator or hardware control.

0 Updated today
thiennc-tesoglobal
Testing & QA Listed

testing-strategy

Enforces test doctrine where shape follows code not the pyramid: pushes logic into Flutter-free packages tested with pure package:test and an injected Clock; asserts invariants with seeded fuzz tests against an independent oracle plus round-trip and rounding goldens; prefers bare-implements fakes over mocktail for code you own; tests the data layer against a real NativeDatabase.memory Drift engine, never a mocked DAO; drives Notifiers headlessly with ProviderContainer overrides; guards one end-to-end acceptance gate and a runtime invariant tripwire; floors coverage on unrecoverable-bug files not a global percentage; and fixes the coverage-lies-upward gap. Use when writing tests under test/ or integration_test/, choosing unit vs widget vs integration, adding a fuzz or round-trip property, wiring a fake or ProviderContainer test, gating coverage, or triaging a flaky-suite failure.

0 Updated 2 weeks ago
zakariaf
Testing & QA Solid

testing

This skill should be used when the user asks to "write tests", "fix failing tests", "improve test coverage", "add integration tests", "debug a flaky test", or reviews test quality. Provides behavior-focused testing patterns, coverage analysis, and detection of brittle test anti-patterns like implementation coupling and non-deterministic assertions.

18 Updated yesterday
dean0x