dart-add-unit-test
Write and organize unit tests for functions, methods, and classes using `package:test`. Use…
Configures Flutter Driver for app interaction and converts MCP actions into permanent integration tests. Use when adding integration testing to a project, exploring UI components via MCP, or automating user flows with the integration_test package.
$ npx -y skills add flutter/agent-plugins --skill flutter-add-integration-test --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/flutter-add-integration-testContext preview
The summary Claude sees to decide when to auto-load this skill.
Configures Flutter Driver for app interaction and converts MCP actions into permanent integration tests. Use when adding integration testing to a project, exploring UI components via MCP, or automating user flows with the integration_test package.
name: flutter-add-integration-test description: Configures Flutter Driver for app interaction and converts MCP actions into permanent integration tests. Use when adding integration testing to a project, exploring UI components via MCP, or automating user flows with the integration_test package. metadata: model: models/gemini-3.1-pro-preview last_modified: Tue, 21 Apr 2026 18:29:20 GMT
Configure the project to support integration testing and Flutter Driver extensions.
1. Add required development dependencies to `pubspec.yaml`:
flutter pub add 'dev:integration_test:{"sdk":"flutter"}'
flutter pub add 'dev:flutter_test:{"sdk":"flutter"}'2. Enable the Flutter Driver extension in your application entry point (typically `lib/main.dart` or a dedicated `lib/main_test.dart`):
3. Add `Key` parameters (e.g., `ValueKey('login_button')`) to critical widgets in the application code to ensure reliable targeting during tests.
Use the Dart/Flutter MCP server tools to interactively explore and manipulate the application state before writing static tests.
Structure integration tests using the `flutter_test` API paradigm.
**Conditional Logic for Legacy `flutter_driver`:**
Execute tests using the `flutter drive` command. Require a host driver script located in `test_driver/integration_test.dart` that calls `integrationDriver()`.
**Conditional Execution Targets:**
`flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d chrome`
1. Build debug APK: `flutter build apk --debug` 2. Build test APK: `./gradlew app:assembleAndroidTest` 3. Upload both APKs to the Firebase Test Lab console.
Copy and follow this checklist to implement and verify integration tests.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:my_app/main.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('End-to-end test', () {
testWidgets('tap on the floating action button, verify counter', (tester) async {
// Load app widget.
await tester.pumpWidget(const MyApp());
// Verify the counter starts at 0.
expect(find.text('0'), findsOneWidget);
// Find the floating action buttoAgent plugins for Flutter, maintained by the Flutter team. A collection of plugins designed to extend AI agent capabilities for Flutter development.
Write and organize unit tests for functions, methods, and classes using `package:test`. Use…
Architectural patterns, entrypoint structure, exit codes, stream routing, and subprocess…
Collect coverage using the coverage packge and create an LCOV report
Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line,…
Define and generate mock objects for external dependencies using `package:mockito` and…
Replace the usage of `expect` and similar functions from `package:matcher` to…