ワンクリックで
testing-patterns
Testing patterns and principles. Unit, integration, mocking strategies.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Testing patterns and principles. Unit, integration, mocking strategies.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Rules and standards for building and scaffolding Flutter applications for AI-assisted development.
This skill is specialized in Flutter mobile application architecture, based on Clean Architecture, strict layer separation, low coupling, and high testability. Its purpose is to guide architectural decisions and validate architectural compliance across the codebase.
AI operational modes (brainstorm, implement, debug, review, teach, ship, orchestrate). Use to adapt behavior based on task type.
Socratic questioning protocol + user communication. MANDATORY for complex requests, new features, or unclear requirements. Includes progress reporting and error handling.
Clean Code rules and standards for Dart and Flutter applications.
Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.
| name | testing-patterns |
| description | Testing patterns and principles. Unit, integration, mocking strategies. |
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash |
Principles for reliable test suites.
/\ E2E (Few)
/ \ Critical flows
/----\
/ \ Integration (Some)
/--------\ API, DB queries
/ \
/------------\ Widget (Flutter)
/ \ Component interactions
/----------------\ Unit (Many)
Functions, classes
| General Term | Dart/Flutter Equivalent |
|---|---|
describe | group('description', () { ... }) |
it / test | test('description', () { ... }) |
beforeEach | setUp(() { ... }) |
afterEach | tearDown(() { ... }) |
beforeAll | setUpAll(() { ... }) |
afterAll | tearDownAll(() { ... }) |
| Step | Purpose |
|---|---|
| Arrange | Set up test data |
| Act | Execute code under test |
| Assert | Verify outcome |
| Type | Best For | Speed |
|---|---|---|
| Unit | BLoCs, Repositories, Logic | Fast (<50ms) |
| Widget | Individual Components, UI | Medium |
| Integration | Device flows, Permissions | Slow |
| Principle | Meaning |
|---|---|
| Fast | < 100ms each |
| Isolated | No external deps |
| Repeatable | Same result always |
| Self-checking | No manual verification |
| Timely | Written with code |
| Test | Don't Test |
|---|---|
| Business logic | Framework code |
| Edge cases | Third-party libs |
| Error handling | Simple getters |
await tester.pumpWidget(...))find.text(...), find.byType(...))expect(finder, findsOneWidget))find.text('Save')find.byType(CircularProgressIndicator)find.byKey(Key('submit_btn'))findsOneWidget, findsNothing, findsNWidgets(2)await expectLater(find.byType(MyWidget), matchesGoldenFile('goldens/my_widget.png'))| Area | Focus |
|---|---|
| API endpoints | Request/response |
| Database | Queries, transactions |
| External services | Contracts |
| Phase | Action |
|---|---|
| Before All | Connect resources |
| Before Each | Reset state |
| After Each | Clean up |
| After All | Disconnect |
| Mock | Don't Mock |
|---|---|
| External APIs | The code under test |
| Database (unit) | Simple dependencies |
| Time/random | Pure functions |
| Network | In-memory stores |
| Type | Use |
|---|---|
| Stub | Return fixed values |
| Spy | Track calls |
| Mock | Set expectations |
| Fake | Simplified implementation |
| Pattern | Example |
|---|---|
| Should behavior | "should return error when..." |
| When condition | "when user not found..." |
| Given-when-then | "given X, when Y, then Z" |
| Level | Use |
|---|---|
| describe | Group related tests |
| it/test | Individual case |
| beforeEach | Common setup |
| Approach | Use |
|---|---|
| Factories | Generate test data |
| Fixtures | Predefined datasets |
| Builders | Fluent object creation |
| Practice | Why |
|---|---|
| One assert per test | Clear failure reason |
| Independent tests | No order dependency |
| Fast tests | Run frequently |
| Descriptive names | Self-documenting |
| Clean up | Avoid side effects |
| ❌ Don't | ✅ Do |
|---|---|
| Test implementation | Test behavior |
| Duplicate test code | Use factories |
| Complex test setup | Simplify or split |
| Ignore flaky tests | Fix root cause |
| Skip cleanup | Reset state |
Remember: Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.