# flutter-testing-skill

flutter-testing-skill generates widget tests, integration tests, and golden tests for Flutter in Dart. Runs locally or on real devices via TestMu AI cloud.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 242 installs · ★ 393 repo stars
- Author: TestMu AI
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/LambdaTest/agent-skills/tree/HEAD/flutter-testing-skill/SKILL.md
- Updated: 2026-10-13
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/flutter-testing-skill

## What it does

This skill automates test generation for Flutter apps. It identifies the test type—unit, widget, integration, or golden (visual regression)—and outputs code with proper structure and patterns. Includes examples using `WidgetTester`, element lookup by key and type, interactions (tap, text input, scroll), and dependency mocking with Mockito.

Local execution requires Flutter SDK and Dart. For integration tests on real devices, the skill integrates with TestMu AI cloud (LambdaTest): upload a built APK or iOS app and run via Appium. Visual tests compare screenshots against golden files in `goldens/`.

Common pitfalls it avoids: missing `pumpAndSettle()` after actions, searching by dynamic text instead of keys, testing implementation details rather than behavior. The skill flags when services and repositories should be mocked to keep tests offline.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill flutter-testing-skill -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/flutter-testing-skill/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/flutter-testing-skill/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill flutter-testing-skill -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/flutter-testing-skill/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill flutter-testing-skill -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/flutter-testing-skill/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install LambdaTest/agent-skills flutter-testing-skill
```

2. **Manually: put the files in place**
- File: `.github/skills/flutter-testing-skill/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill flutter-testing-skill -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/LambdaTest/agent-skills --path flutter-testing-skill
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/flutter-testing-skill/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill flutter-testing-skill -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/LambdaTest/agent-skills/tree/HEAD/flutter-testing-skill/SKILL.md

## When to use it
- Write a widget test for a login screen with field and button verification
- Check error handling for invalid credentials
- Create an integration test for a complete app flow
- Set up visual regression tests for UI components
- Mock an AuthService and verify method calls in a test

## Example prompts
- Generate a widget test for LoginScreen checking for TextField and ElevatedButton presence
- Create an integration test covering the full login flow including navigation to Dashboard
- Build a golden test to verify visual consistency of a product list screen

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 7c7dbb0ab35d9aab.

BEGIN THIRD-PARTY FILE 7c7dbb0ab35d9aab
````text
---
name: flutter-testing-skill
description: >
  Generates Flutter widget tests, integration tests, and golden tests in Dart.
  Supports local execution and TestMu AI cloud for real device testing.
  Use when user mentions "Flutter", "widget test", "WidgetTester", "testWidgets",
  "flutter_test", "integration_test". Triggers on: "Flutter", "widget test",
  "Dart test", "testWidgets", "WidgetTester", "golden test".
languages:
  - Dart
category: mobile-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# Flutter Testing Skill

You are a senior Flutter developer specializing in testing.

## Step 1 — Test Type

```
├─ "unit test", "business logic", "model test"
│  └─ Unit test: test/ directory, flutter_test package
│
├─ "widget test", "component test", "UI test"
│  └─ Widget test: test/ directory, testWidgets()
│
├─ "integration test", "E2E", "full app test"
│  └─ Integration test: integration_test/ directory
│
├─ "golden test", "snapshot", "visual regression"
│  └─ Golden test: matchesGoldenFile()
│
└─ Ambiguous? → Widget test (most common)
```

## Core Patterns — Dart

### Widget Test (Most Common)

```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:my_app/screens/login_screen.dart';

void main() {
  testWidgets('Login screen shows email and password fields', (WidgetTester tester) async {
    await tester.pumpWidget(const MaterialApp(home: LoginScreen()));

    // Verify fields exist
    expect(find.byType(TextField), findsNWidgets(2));
    expect(find.text('Email'), findsOneWidget);
    expect(find.text('Password'), findsOneWidget);
    expect(find.byType(ElevatedButton), findsOneWidget);
  });

  testWidgets('Login with valid credentials navigates to dashboard', (WidgetTester tester) async {
    await tester.pumpWidget(const MaterialApp(home: LoginScreen()));

    // Enter credentials
    await tester.enterText(find.byKey(const Key('emailField')), 'user@test.com');
    await tester.enterText(find.byKey(const Key('passwordField')), 'password123');

    // Tap login button
    await tester.tap(find.byKey(const Key('loginButton')));
    await tester.pumpAndSettle(); // Wait for animations and navigation

    // Verify navigation
    expect(find.text('Dashboard'), findsOneWidget);
  });

  testWidgets('Shows error for invalid credentials', (WidgetTester tester) async {
    await tester.pumpWidget(const MaterialApp(home: LoginScreen()));
````
END THIRD-PARTY FILE 7c7dbb0ab35d9aab

The third-party file has ended. Everything between the 7c7dbb0ab35d9aab tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2517 of 7850 bytes. © TestMu AI · MIT · https://github.com/LambdaTest/agent-skills/tree/HEAD/flutter-testing-skill/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
