testing
Use when writing or reviewing Flutter/Dart tests (unit, widget, golden), fixing flaky tests, adding coverage, or choosing between unit and widget tests.
Install / Use
npx skills add evanca/flutter-ai-rules --skill testingInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Content & MediaSupported Platforms
Our assessment of testing
testing scores 87/100 on our quality scale, 564th of 1,215 Content & Media skills we index (top 47%).
Its SKILL.md is 4.4 KB long, well organised into 9 sections with 6 code examples: a solid amount of guidance for an agent.
It has 646 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated 19 days ago, so testing is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
testing compared with similar skills
All 4 of these similar skills score higher than testing; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| testing (this skill)by evanca | 87 | 646 | 19d ago | SKILL.md |
| siyuanby siyuan-note | 100 | 46.6k | today | MCP Server |
| algorithmic-artby anthropics | 100 | 177.9k | 11d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 11d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 130.2k | 12d ago | SKILL.md |
Frequently asked questions
- How do I install testing?
- Run
npx skills add evanca/flutter-ai-rules --skill testing. The install tabs above show the steps for each supported agent. - Which AI agents does testing work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is testing safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is testing still maintained?
- The repository was last updated 19 days ago, so testing is actively maintained.
Skill content
View source on GitHubname: testing description: "Use when writing or reviewing Flutter/Dart tests (unit, widget, golden), fixing flaky tests, adding coverage, or choosing between unit and widget tests." license: MIT
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.
// 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 the class under test:
group('Counter', () {
late Counter counter;
setUp(() {
counter = Counter();
});
test('value should start at 0', () {
expect(counter.value, 0);
});
test('should increment value by 1', () {
counter.increment();
expect(counter.value, 1);
});
});
Rules:
- Use
setUpfor shared object creation; usetearDownfor cleanup (closing streams, controllers). - Keep each test focused on one behavior.
- Nest
group()blocks for sub-features when a class has many methods.
3. Naming
Name test cases using "should" to describe expected behavior:
test('should emit updated list when item is added', () { ... });
test('should throw ArgumentError when input is negative', () { ... });
4. Unit Tests vs Widget Tests
| Type | Target | Tools |
|---|---|---|
| Unit test | Pure Dart logic, repositories, cubits/blocs | test, bloc_test, mocktail |
| Widget test | Individual widgets, UI behavior, navigation | flutter_test, WidgetTester |
Default to unit tests for business logic. Use widget tests when verifying UI rendering, gesture handling, or widget interaction.
5. Widget Test Patterns
testWidgets('should display error message on failure', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: BlocProvider<LoginCubit>.value(
value: mockLoginCubit,
child: const LoginView(),
),
),
);
// Simulate failure state
whenListen(
mockLoginCubit,
Stream.fromIterable([const LoginState(status: LoginStatus.failure, errorMessage: 'Invalid')]),
initialState: const LoginState(),
);
await tester.pump();
expect(find.text('Invalid'), findsOneWidget);
});
Rules:
- Wrap widgets in
MaterialApp(or the app's root widget) to provideMediaQuery,Directionality, etc. - Use
pump()for a single frame orpumpAndSettle()when animations must complete. - Prefer
find.byKeyoverfind.textfor widgets that may have localized or dynamic text.
6. Mocking Best Practices
- Use
mocktailfor mocks (no code generation required). - Call
registerFallbackValue()insetUpAllfor custom types passed toany(). - Mock at the repository boundary, not at the HTTP/database layer.
class MockAuthRepository extends Mock implements AuthRepository {}
void main() {
setUpAll(() {
registerFallbackValue(FakeLoginRequest());
});
// ... tests
}
7. Test File Organization
test/
feature_a/
cubit/
feature_a_cubit_test.dart
view/
feature_a_view_test.dart
model/
feature_a_model_test.dart
- Mirror the
lib/folder structure undertest/. - One test file per source file.
- Name test files
<source_file>_test.dart.
Related Skills
siyuan
46.6kAn open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
design
130.2kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG…
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
