К основному содержанию
скилл CX Codex

flutter-testing — скилл для Claude Code: тесты Flutter без догадок

Скилл для написания, починки и отладки тестов Flutter: юнит-, виджет- и интеграционные тесты, моки, golden-проверки.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add MADTeacher/mad-agents-skills --skill flutter-testing -a claude-code
Открыть на GitHub

Что делает flutter-testing

Скилл задаёт агенту порядок работы: сначала осмотреть проект — pubspec.yaml, каталоги test/, integration_test/, test_driver/, сгенерированные моки, управление состоянием и команды CI. Потом выбрать слой тестов. Чистые функции Dart, репозитории, сервисы и view-модели идут в юнит-тесты, отдельные виджеты, формы и навигация — в виджет-тесты, полные пользовательские сценарии и мосты к нативному коду — в интеграционные.

Дальше агент читает только те справочники, что нужны под конкретный сценарий: references/unit-testing.md, references/widget-testing.md, references/integration-testing.md, references/mocking.md, references/common-errors.md, references/plugin-testing.md. Реализация идёт в стиле проекта — с его внедрением зависимостей, ключами и фикстурами. В конце обязательна проверка: сначала самая узкая команда вроде flutter test test/my_widget_test.dart, для интеграционных тестов на устройстве — flutter test -d <device-id> integration_test/<test_file>.dart.

Есть жёсткие запреты. Нельзя прятать неопределённость асинхронности фиксированными Future.delayed — нужны детерминированные фейки и явные pump. Нельзя использовать устаревшее: --no-sound-null-safety, flutter test --platform ..., tester.trace, captureNamed, flutter pub run build_runner build. Если проверку запустить не удалось, скилл требует назвать точную команду, которая упала, и оставшийся риск — вместо отчёта «всё готово».

Какие задачи решает

  • выбрать между юнит-, виджет- и интеграционным тестом для конкретного кода
  • починить падающий тест с MissingPluginException или ошибкой finder
  • замокать MethodChannel и зависимости через Mockito или mocktail
  • перегенерировать моки через build_runner перед прогоном тестов
  • разобраться с флаки-тестами и зависаниями на pumpAndSettle

Примеры запросов агенту

  • Напиши виджет-тест для формы логина, найди существующий стиль тестов в проекте
  • Почему падает тест с MissingPluginException при вызове плагина — посмотри и почини
  • Добавь интеграционный тест на сценарий оформления заказа и запусти его на устройстве

Как установить flutter-testing

1Через Skills CLI (Vercel)

npx skills add MADTeacher/mad-agents-skills --skill flutter-testing -a claude-code

2Вручную: положить файлы

~/.claude/skills/flutter-testing/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/flutter-testing/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора10

flutter-animations Скилл для работы с анимациями во Flutter: добавить, починить, отрефакторить или объяснить движение в интерфейсе. CX Codex +1 15 400установок flutter-adaptive-ui Скилл направляет агента при разработке адаптивного UI во Flutter для мобильных экранов, десктопа и веба. Он заставляет опираться на ограничения окна, а не на имя платформы. CX Codex +1 2 000установок flutter-architecture Скилл для проектирования и ревью архитектуры Flutter-приложений: слои, MVVM, feature-first структура, DI и паттерны вроде Result и Command. CX Codex +1 1 700установок flutter-networking Скилл для работы с сетью во Flutter: HTTP/REST, WebSocket, авторизация, таймауты, ретраи, парсинг JSON и кэш. Пригодится, когда надо добавить запросы или разобрать сетевые ошибки. CX Codex +1 722установок flutter-drift Ведёт агента по работе с локальной базой на Drift: таблицы, запросы, реактивные стримы, миграции схемы и тесты. Пригодится, когда в проекте уже есть SQLite или вы только его заводите. CX Codex +1 671установок flutter-navigation Скилл для ИИ-агента, который разбирается с навигацией во Flutter: Navigator, go_router, диплинки, редиректы и история браузера. CX Codex +1 589установок flutter-internationalization Настраивает и чинит локализацию во Flutter через gen-l10n и ARB-файлы. Помогает перевести интерфейс, поддержать RTL и убрать устаревшие импорты package:flutter_gen. CX Codex +1 536установок dart-drift Скилл для работы с Drift в Dart CLI, серверных и десктопных приложениях без Flutter: таблицы, запросы, миграции, PostgreSQL. CX Codex +1 466установок

Похожие

flutter-expert Seth Hobson Помогает проектировать Flutter-приложения, писать интерфейсы и разбирать интеграции для разных платформ. Подключайте его к задачам на Dart, тестирование или производительность. CX Codex 720установок dart-add-unit-test dart-lang Пишет unit-тесты на Dart и Flutter через package:test: раскладывает файлы по test/, добавляет моки и гоняет прогон до зелёного. CX Codex +1 19 200установок flutter-add-widget-test flutter Скилл помогает писать компонентные тесты Flutter с помощью WidgetTester. Проверяет, как виджет отображается и реагирует на касания, скролл и ввод текста. CX Codex +1 39 200установок flutter-add-integration-test flutter Скилл настраивает интеграционные тесты во Flutter через пакет integration_test. Он переносит действия из MCP-сервера в готовые тестовые сценарии. CX Codex +1 38 200установок flutter-dev MiniMax-AI Гайд для разработки Flutter-приложений с паттернами виджетов, Riverpod, Bloc и GoRouter. Пригодится при настройке интерфейса, навигации, тестов и производительности. CX Codex +1 2 000установок flutter alinaqi Скилл для работы с Flutter и Dart: подсказывает структуру проекта, провайдеры Riverpod, модели Freezed и навигацию go_router. CX Codex +1 736установок

Рядом в теме «Тесты и QA»

Всё по теме «Тесты и QA» →

Вопросы о flutter-testing

Как установить flutter-testing в Claude?

Выполните npx skills add MADTeacher/mad-agents-skills --skill flutter-testing -a claude-code. После этого скилл окажется в ~/.claude/skills/flutter-testing/SKILL.md.

Что делает flutter-testing?

Помогает агенту писать, чинить и проверять тесты Flutter: юнит-, виджет- и интеграционные, с моками, golden-проверками и разбором типовых ошибок.

Нужен ли build_runner для работы скилла?

Только если в проекте есть сгенерированные моки Mockito. После их правки скилл требует прогнать dart run build_runner build или принятую в репозитории команду сборки до запуска тестов.

Исходный текст

SKILL.md · MIT
---
name: flutter-testing
description: >-
  Write, fix, review, debug, and validate Flutter tests for apps, packages,
  and plugins. Use when adding unit tests, widget tests, integration tests,
  MethodChannel or plugin mocks, Mockito or mocktail test doubles, golden or
  accessibility checks, CI test commands, test failures, MissingPluginException,
  pump or pumpAndSettle problems, finder errors, build_runner mock generation,
  device integration testing, web integration testing, or flaky Flutter tests.
metadata:
  author: Stanislav [MADTeacher] Chernyshev
  version: "2.0"
---

# Flutter Testing

You are a Flutter testing engineer for app, package, and plugin projects.

## Principle 0

Do not write Flutter tests from memory. First inspect the project, choose the
right test layer, read the routed reference for the scenario, then run the
closest validation command. Broken or flaky tests waste more time than missing
tests because they create false confidence and slow future changes.

## Workflow

1. Inspect the project before changing tests: `pubspec.yaml`, existing `test/`,
   `integration_test/`, `test_driver/`, generated mock files, state management,
   platform abstractions, plugin usage, and CI commands.
2. Choose the test layer:
   - Pure Dart functions, repositories, services, state reducers, and view
     models: unit tests.
   - Single widgets, forms, navigation shells, semantics, gestures, responsive
     layout, and UI state: widget tests.
   - Complete user flows, real device behavior, screenshots, performance
     reports, native/plugin bridges, and browser/device targets: integration
     tests.
   - Flutter plugins or app code using platform channels: plugin and mocking
     guidance.
3. Read only the reference files needed for the chosen scenario.
4. Implement the smallest deterministic test or test fix using the project's
   existing test style, dependency injection pattern, keys, fixtures, mocks, and
   CI constraints.
5. Run mandatory validation. If validation cannot run, report the exact blocker
   and the concrete risk instead of presenting the change as verified.

## Resource Routing

| Task | Read or run | Why |
|---|---|---|
| Write or fix pure Dart tests, async tests, stream tests, matchers, exceptions, or test organization | `references/unit-testing.md` | Unit-test patterns that compile under Dart null safety |
| Write or fix widget tests, finders, gestures, forms, navigation, semantics, scrolling, animations, or layout-size tests | `references/widget-testing.md` | `flutter_test` APIs and widget-specific pitfalls |
| Add or fix integration tests, device/browser runs, performance reports, screenshots, persistence flows, platform scenarios, or CI integration | `references/integration-testing.md` | Current `integration_test` APIs and target commands |
| Mock dependencies, repositories, platform channels, generated Mockito mocks, manual fakes, or state-management collaborators | `references/mocking.md` | Deterministic test-double patterns and mock generation |
| Diagnose failing tests, layout errors, `MissingPluginException`, finder failures, timeouts, async hangs, or debugging output | `references/common-errors.md` | Error-to-fix mapping without guessing |
| Test Flutter plugin packages, native Android/iOS code, example-app integration tests, or plugin registration/error paths | `references/plugin-testing.md` | Plugin package layout and native/Dart test split |
| Edit this skill, references, or examples | `scripts/verify-examples.sh` | Deterministic smoke check for stale patterns and broken links |

## Mandatory Validation

- After editing Dart tests or production code, run the narrowest relevant
  command first, such as `flutter test test/my_widget_test.dart`,
  `flutter test --plain-name "subtree"`, or `dart test` for pure Dart packages.
- After adding or changing generated Mockito mocks, run
  `dart run build_runner build` or the repository's established build command
  before running tests.
- For integration tests on mobile or desktop targets, run `flutter test -d
  <device-id> integration_test/<test_file>.dart` when a device target is
  required; otherwise run the documented project command.
- For browser integration tests that require `integrationDriver`, run
  `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/<test_file>.dart -d chrome`
  or the project's web driver command.
- After fixing flaky tests, run the specific test more than once or use the
  repository's repeat/randomization option if one exists.
- After editing this skill or its references, run
  `bash flutter-testing/scripts/verify-examples.sh`.

## Constraints

- Prefer `package:flutter_test/flutter_test.dart` for widget and integration
  tests, and `package:test/test.dart` only for pure Dart tests that do not need
  Flutter bindings.
- Test user-visible behavior and public contracts. Do not assert private method
  calls, widget internals, or incidental rebuild counts unless performance work
  explicitly requires it.
- Prefer dependency injection, fake repositories, fake platform interfaces, or
  MethodChannel handlers over real network, real storage, timers, permissions,
  or OS dialogs.
- Do not use fixed `Future.delayed` waits to hide async uncertainty. Use
  deterministic fakes, explicit pumps, `pumpAndSettle` only when animations can
  settle, or bounded custom pumps.
- Do not use obsolete commands or APIs: `--no-sound-null-safety`,
  `flutter test --platform ...`, `tester.trace`, `tester.takeScreenshot`,
  `captureNamed`, or `flutter pub run build_runner build`.
- Do not simulate connectivity, permissions, or persistence by changing the
  test surface size or by re-pumping the app with hidden state. Use explicit
  fakes, test hooks, or real integration targets.

## Fallback

If the repository lacks enough context to choose the test layer, ask for the
target behavior and preferred test level. If devices, browsers, native tooling,
network access, code generation, or dependency downloads block validation,
finish with the exact command that failed, what was not verified, and the risk
left for the user.

© Stanislav [MADTeacher] Chernyshev · MIT · MADTeacher/mad-agents-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой