Comprehensive guidance for unit, widget, and integration testing across Flutter applications.
Works with
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
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionflutter-testingExecute the skills CLI command in your project's root directory to begin installation:
Fetches flutter-testing from madteacher/mad-agents-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate flutter-testing. Access via /flutter-testing in your agent's command palette.
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 environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
91
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
91
stars
This skill provides comprehensive guidance for testing Flutter applications across all test types. Flutter testing falls into three categories:
A well-tested Flutter app has many unit and widget tests for code coverage, plus enough integration tests to cover important use cases.
| Tradeoff | Unit | Widget | Integration |
|---|---|---|---|
| Confidence | Low | Higher | Highest |
| Maintenance cost | Low | Higher | Highest |
| Dependencies | Few | More | Most |
| Execution speed | Quick | Quick | Slow |
Flutter supports three build modes with different implications for testing:
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 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 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/
What are you testing?
Does it depend on plugins/native code?
Need to mock dependencies?
Encountering errors?
Unit tests verify the correctness of a unit of logic under various conditions.
package:test/test.dartFor mocking dependencies, plugin interactions, and complex scenarios, see Unit Testing Reference.
Widget tests verify widget UI appearance and behavior in a test environment.
// 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);
// 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();
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));
});
For scrolling, complex interactions, and performance testing, see Widget Testing Reference.
Integration tests test complete apps or large parts on real devices or emulators.
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ 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.
aj-geddes/useful-ai-prompts
github/awesome-copilot
refoundai/lenny-skills
ajianaz/skills-collection
flutter/skills
jeffallan/claude-skills
flutter-testing is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Registry listing for flutter-testing matched our evaluation — installs cleanly and behaves as described in the markdown.
I recommend flutter-testing for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Useful defaults in flutter-testing — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Keeps context tight: flutter-testing is the kind of skill you can hand to a new teammate without a long onboarding doc.
Registry listing for flutter-testing matched our evaluation — installs cleanly and behaves as described in the markdown.
flutter-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
flutter-testing has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 71