flutter-testing
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)
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.
More from flutter/skills
flutter-building-layouts
Builds Flutter layouts using the constraint system and layout widgets. Use when creating or refining the UI structure of a Flutter application.
10.6Kflutter-architecting-apps
Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability.
10.4Kflutter-animating-apps
Implements animated effects, transitions, and motion in a Flutter app. Use when adding visual feedback, shared element transitions, or physics-based animations.
9.6Kflutter-managing-state
Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions.
9.6Kflutter-theming-apps
Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
9.5Kflutter-implementing-navigation-and-routing
Handles routing, navigation, and deep linking in a Flutter application. Use when moving between screens or setting up URL-based navigation.
9.3K