# Write Flutter Tests

> Write and extend Dart/Flutter unit (bloc/cubit), widget, and Patrol E2E tests using bloc_test, mocktail, page objects, and project templates. Use when asked to write, add, update, fix, or refactor Flutter tests or test setup.

- **Type:** Skill
- **Install:** `agentstack add skill-wreos-flutter-cursor-plugin-write-flutter-tests`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Wreos](https://agentstack.voostack.com/s/wreos)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Wreos](https://github.com/Wreos)
- **Source:** https://github.com/Wreos/flutter-cursor-plugin/tree/main/skills/write-flutter-tests
- **Website:** https://docs.flutter.dev/ai/get-started

## Install

```sh
agentstack add skill-wreos-flutter-cursor-plugin-write-flutter-tests
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Write Flutter Tests

Use this skill as the single entry point for Flutter test work.

## Workflow

1. Detect scope: widget test vs bloc/cubit test vs Patrol E2E test.
2. If the repo has shared test setup helpers (for example `TestEnv`, `pumpApp`), reuse them.
3. Load only the needed guide:
   - Widget: `widget-tests.md`
   - Bloc/Cubit: `bloc-tests.md`
   - Integration/E2E (Patrol): `integration-tests.md`
4. Apply shared constraints from `../../rules/flutter-test-best-practices.mdc`.
5. Start from the matching template:
   - `../../templates/widget_test_template.dart`
   - `../../templates/bloc_test_template.dart`
   - `../../templates/integration_test_template.dart`
6. Run only impacted tests and fix failures.
7. Prefer behavior-first assertions:
   - user action -> observable outcome,
   - expected branch visible + conflicting branch hidden,
   - avoid synthetic-only style assertions unless style is the requirement.

## Description Format

- Event tests: `WHEN user taps  THEN `
- State tests: `GIVEN  THEN `
- Never write: `WHEN widget is pumped` / `WHEN page is built`

## Progressive Disclosure

- Keep this file short.
- Put implementation detail in:
  - `widget-tests.md`
  - `bloc-tests.md`
  - `integration-tests.md`
  - `../../docs/test-environment-setup.md`

## Guardrails

- Prefer deterministic tests over time-dependent assertions.
- Keep test setup local unless shared helpers already exist.
- Avoid broad snapshot/golden assertions unless explicitly requested.
- Do not present sample test snippets as completed repository changes without file-level confirmation.

## Required output

1. Test type selected and why.
2. Files created/updated.
3. Test commands run and results.
4. Flakiness risks or missing coverage notes.
5. Next test to add (single highest-value gap).

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Wreos](https://github.com/Wreos)
- **Source:** [Wreos/flutter-cursor-plugin](https://github.com/Wreos/flutter-cursor-plugin)
- **License:** MIT
- **Homepage:** https://docs.flutter.dev/ai/get-started

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-wreos-flutter-cursor-plugin-write-flutter-tests
- Seller: https://agentstack.voostack.com/s/wreos
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
