flutter-testing

madteacher/mad-agents-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/madteacher/mad-agents-skills --skill flutter-testing
0 commentsdiscussion
summary

Comprehensive guidance for unit, widget, and integration testing across Flutter applications.

  • Covers three test types with trade-off analysis: unit tests for isolated logic (fast, low maintenance), widget tests for UI components (higher confidence, more dependencies), and integration tests for end-to-end flows (highest confidence, slowest execution)
  • Includes practical examples for all three test categories, from basic Counter tests to complex user flows and performance profiling
  • Prov
skill.md

Flutter Testing

Overview

This skill provides comprehensive guidance for testing Flutter applications across all test types. Flutter testing falls into three categories:

  • Unit tests - Test individual functions, methods, or classes in isolation
  • Widget tests (component tests) - Test single widgets and verify UI appearance and behavior
  • Integration tests - Test complete apps or large parts to verify end-to-end functionality

A well-tested Flutter app has many unit and widget tests for code coverage, plus enough integration tests to cover important use cases.

Test Type Trade-offs

Tradeoff Unit Widget Integration
Confidence Low Higher Highest
Maintenance cost Low Higher Highest
Dependencies Few More Most
Execution speed Quick Quick Slow

Build Modes for Testing

Flutter supports three build modes with different implications for testing:

  • Debug mode - Use during development with hot reload. Assertions enabled, debugging enabled, but performance is janky
  • Profile mode - Use for performance analysis. Similar to release mode but with some debugging features enabled
  • Release mode - Use for deployment. Assertions disabled, optimized for speed and size

Quick Start

Unit Tests

Unit tests test a single function, method, or class. Mock external dependencies and avoid disk I/O or UI rendering.

import 'package:test/test.dart';
import 'package:my_app/counter.dart';

void main() {
  test('Counter value should be incremented', () {
    final counter = Counter();
    counter.increment();
    expect(counter.value, 1);
  });
}

Run with: flutter test

Widget Tests

Widget tests test single widgets to verify UI appearance and interaction.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('MyWidget has a title and message', (tester) async {
    await tester.pumpWidget(const MyWidget(title: 'T', message: 'M'));
    
    final titleFinder = find.text('T');
    final messageFinder = find.text('M');
    
    expect(titleFinder, findsOneWidget);
    expect(messageFinder, findsOneWidget);
  });
}

Integration Tests

Integration tests test complete apps on real devices or emulators.

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:my_app/main.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  
  testWidgets('tap button, verify counter', (tester) async {
    await tester.pumpWidget(const MyApp());
    expect(find.text('0'), findsOneWidget);
    
    await tester.tap(find.byKey(const ValueKey('increment')));
    await tester.pumpAndSettle();
    
    expect(find.text('1'), findsOneWidget);
  });
}

Run with: flutter test integration_test/

Testing Workflow Decision Tree

  1. What are you testing?

  2. Does it depend on plugins/native code?

  3. Need to mock dependencies?

  4. Encountering errors?

Unit Tests

Unit tests verify the correctness of a unit of logic under various conditions.

When to Use Unit Tests

  • Testing business logic functions
  • Validating data transformations
  • Testing state management logic
  • Mocking external services/API calls

Key Concepts

  • Use package:test/test.dart
  • Mock dependencies using Mockito or similar
  • Avoid file I/O or UI rendering
  • Fast execution, high maintainability

Advanced Unit Testing

For mocking dependencies, plugin interactions, and complex scenarios, see Unit Testing Reference.

Widget Tests

Widget tests verify widget UI appearance and behavior in a test environment.

When to Use Widget Tests

  • Testing widget rendering
  • Verifying user interactions (taps, drags, scrolling)
  • Testing different orientations
  • Validating widget state changes

Widget Testing Patterns

Finding Widgets

// By text
final titleFinder = find.text('Title');

// By widget type
final buttonFinder = find.byType(ElevatedButton);

// By key
final fabFinder = find.byKey(const ValueKey('increment'));

// By widget instance
final myWidgetFinder = find.byWidget(myWidgetInstance);

User Interactions

// Tap
await tester.tap(buttonFinder);

// Drag
await tester.drag(listFinder, const Offset(0, -300));

// Enter text
await tester.enterText(fieldFinder, 'Hello World');

// Scroll
await tester.fling(listFinder, const Offset(0, -500), 10000);
await tester.pumpAndSettle();

Testing Different Orientations

testWidgets('widget in landscape mode', (tester) async {
  // Set to landscape
  await tester.binding.setSurfaceSize(const Size(800, 400));
  await tester.pumpWidget(const MyApp());
  
  // Verify landscape behavior
  expect(find.byType(MyWidget), findsOneWidget);
  
  // Reset to portrait
  addTearDown(tester.binding.setSurfaceSize(null));
});

Advanced Widget Testing

For scrolling, complex interactions, and performance testing, see Widget Testing Reference.

Integration Tests

Integration tests test complete apps or large parts on real devices or emulators.

When to Use Integration Tests

  • Testing complete user flows
  • Verifying multiple screens/pages
  • Testing navigation flows
  • Performance profiling

Integration Test Structure

how to use flutter-testing

How to use flutter-testing on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add flutter-testing
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/madteacher/mad-agents-skills --skill flutter-testing

The skills CLI fetches flutter-testing from GitHub repository madteacher/mad-agents-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/flutter-testing

Reload or restart Cursor to activate flutter-testing. Access the skill through slash commands (e.g., /flutter-testing) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.671 reviews
  • Liam Jain· Dec 28, 2024

    flutter-testing is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Naina Flores· Dec 24, 2024

    flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • James Singh· Dec 24, 2024

    flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Dev Huang· Dec 20, 2024

    Registry listing for flutter-testing matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Dhruvi Jain· Dec 4, 2024

    I recommend flutter-testing for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Oshnikdeep· Nov 23, 2024

    Useful defaults in flutter-testing — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Liam Mehta· Nov 19, 2024

    Keeps context tight: flutter-testing is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • James Tandon· Nov 15, 2024

    Registry listing for flutter-testing matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Liam Kapoor· Nov 11, 2024

    flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Ganesh Mohane· Oct 14, 2024

    flutter-testing has been reliable in day-to-day use. Documentation quality is above average for community skills.

showing 1-10 of 71

1 / 8