Token导航 LogoToken导航TokenDH.com
研究检索权限需确认github未标认证来源可访问许可证需确认审计通过

flutter-testingFlutter 测试

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

2,351

周安装

97

GitHub Stars

17

下载量

768
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flutter-testing(Flutter 测试)
来源仓库:https://github.com/dhruvanbhalara/skills
仓库路径:skills/flutter-testing
安装命令:
npx skills add https://github.com/dhruvanbhalara/skills --skill flutter-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dhruvanbhalara/skills --skill flutter-testing

简介

flutter-testing 实施测试金字塔策略,要求 100% logic 与 widget 覆盖率达标。

  • 测试文件必须严格镜像 lib 结构并以 _test.dart 结尾,保证组织一致性。
  • 每个测试独立无共享状态,采用 Arrange-Act-Assert 模式提升可读性。
  • mock 依赖项并使用 bloc_test 简化状态流转验证,避免 UI 层级过度耦合。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Testing Strategy

  • Test Pyramid: More unit and widget tests, fewer integration tests. Unit tests are fastest and cheapest.
  • Mirror Test Rule: 100% logic and widget coverage. No code without a test.
  • Mirror Organization: Test files MUST strictly mirror the lib/ directory structure and end with _test.dart.
  • Coverage Targets: Target 100% logic coverage for domain and bloc layers.
  • Test Independence: Each test MUST be independent. No shared mutable state between tests.

Unit Testing

  • Follow the Arrange-Act-Assert (Given-When-Then) convention for clear and maintainable tests
  • Use mocks for dependencies except for lightweight third-party services
  • Test business logic in isolation from the UI
  • For tests, ensure to create 5 to 8 tests for logical operations with real scenarios
  • Mocking Protocol: Use mocktail for all dependency mocking. STRICTLY prohibit using real implementation dependencies in unit tests.
  • Pure Logic: Business logic inside BLoCs or UseCases should be extracted to static pure functions for 100% unit test coverage.

Widget Testing

  • Write widget tests for all major UI components
  • Test user interactions and state changes
  • Widget Keys: Use Key('feature_action_id') format on interactive widgets for test access
  • Test Localization: Use AppLocalizations (context.l10n) in widget tests — no hardcoded strings

Integration Testing

  • Use IntegrationTestWidgetsFlutterBinding.ensureInitialized() at the start of integration tests
  • Interact with widgets via Key (e.g., find.byKey(const ValueKey('increment')))
  • Use pumpAndSettle() to wait for animations and async operations to complete
  • Run with: flutter test integration_test/

Test Naming & Structure

  • Test Naming: Use string interpolation for test group names: group('$ClassName', not group('ClassName',. This ensures consistency and enables better tooling support.
  • Test Grouping: Use group() to organize tests by feature, class, or state for clearer reporting.
  • Descriptive Names: Test names should clearly describe what is being tested and why.

Common Test Errors

  • A RenderFlex overflowed... — Wrap widget in Expanded or constrain dimensions in test
  • Vertical viewport was given unbounded height — Wrap ListView in SizedBox with fixed height in test
  • setState called during build — Defer state changes to post-frame callback

Running Tests

  • flutter test — Run all unit and widget tests
  • flutter test test/path/to/file_test.dart — Run specific test file
  • flutter test integration_test/ — Run integration tests
  • flutter test --coverage — Run with coverage report

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.38%
按下载量换算264

Claude

30.9%
按下载量换算237

Cursor

20.82%
按下载量换算160

Gemini CLI

9.7%
按下载量换算74

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills