flutter-testing

Installation
Summary

Generates unit, widget, integration, and plugin tests for Flutter applications with architectural awareness.

  • Analyzes target code to determine appropriate test type (unit for logic, widget for UI, integration for end-to-end, plugin for native code)
  • Provides decision tree and step-by-step implementation patterns for each test category, including fake/mock setup and assertion strategies
  • Includes ready-to-use code templates for ViewModels, Repositories, widgets, and full app flows with proper file placement (test/, integration_test/ directories)
  • Covers platform-specific plugin testing guidance for Android (JUnit), iOS/macOS (XCTest), and Linux/Windows (GoogleTest)
SKILL.md

flutter-automated-testing

Goal

Generates, configures, and debugs automated tests for Flutter applications, encompassing unit, widget, integration, and plugin testing. Analyzes architectural components (such as MVVM layers) to produce isolated, mock-driven tests and end-to-end device tests. Assumes a standard Flutter project structure, existing business logic, and familiarity with Dart testing paradigms.

Instructions

1. Determine Test Type (Decision Logic)

Evaluate the user's target code to determine the appropriate testing strategy using the following decision tree:

  • If verifying a single function, method, ViewModel, or Repository: Implement a Unit Test (Proceed to Step 2).
  • If verifying a single widget's UI, layout, or interaction: Implement a Widget Test (Proceed to Step 3).
  • If verifying complete app behavior, routing, or performance on a device: Implement an Integration Test (Proceed to Step 4).
  • If verifying platform-specific native code (MethodChannels): Implement a Plugin Test (Proceed to Step 5).

STOP AND ASK THE USER: "Which specific class, widget, or flow are we testing today? Please provide the relevant source code if you haven't already."

2. Implement Unit Tests (Logic & Architecture)

Unit tests verify logic without rendering UI. They must reside in the test/ directory and end with _test.dart.

  • For ViewModels (UI Layer Logic): Fake the repository dependencies. Do not rely on Flutter UI libraries.
Related skills
Installs
1.0K
Repository
flutter/skills
GitHub Stars
1.9K
First Seen
Mar 4, 2026