1600+ lines of testing mastery - unit tests, widget tests, integration tests, E2E, coverage, mocking with production-ready code examples.
Provides production-ready Flutter testing patterns for unit, widget, and integration tests with mocking and coverage. Use when writing or debugging Flutter tests to ensure bulletproof app quality.
/plugin marketplace add pluginagentmarketplace/custom-plugin-flutter/plugin install custom-plugin-flutter@pluginagentmarketplace-flutterThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/testing_config.yamlreferences/TESTING_GUIDE.mdscripts/test_generator.py// Unit test
void main() {
group('Calculator', () {
late Calculator calc;
setUp(() {
calc = Calculator();
});
test('add returns sum', () {
expect(calc.add(2, 3), equals(5));
});
});
}
// Widget test
void main() {
testWidgets('Counter increments', (tester) async {
await tester.pumpWidget(const MyApp());
expect(find.text('0'), findsOneWidget);
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
expect(find.text('1'), findsOneWidget);
});
}
// Integration test
void main() {
group('User Flow', () {
testWidgets('Complete user journey', (tester) async {
await tester.pumpWidget(const MyApp());
await tester.tap(find.text('Login'));
await tester.pumpAndSettle();
expect(find.text('Welcome'), findsOneWidget);
});
});
}
class UserService {
Future<User> getUser(String id) async {
// Implementation
}
}
void main() {
group('UserService', () {
late UserService service;
late MockUserRepository mockRepository;
setUp(() {
mockRepository = MockUserRepository();
service = UserService(mockRepository);
});
test('getUser returns user', () async {
final user = User(id: '1', name: 'John');
when(mockRepository.getUser('1')).thenAnswer((_) async => user);
final result = await service.getUser('1');
expect(result, user);
verify(mockRepository.getUser('1')).called(1);
});
test('getUser throws on error', () async {
when(mockRepository.getUser('1'))
.thenThrow(Exception('Not found'));
expect(
() => service.getUser('1'),
throwsException,
);
});
});
}
void main() {
testWidgets('Render user card', (tester) async {
const user = User(id: '1', name: 'John Doe', email: 'john@example.com');
await tester.pumpWidget(
MaterialApp(home: Scaffold(body: UserCard(user: user))),
);
expect(find.text('John Doe'), findsOneWidget);
expect(find.text('john@example.com'), findsOneWidget);
});
testWidgets('Tap user card navigates', (tester) async {
const user = User(id: '1', name: 'John Doe', email: 'john@example.com');
await tester.pumpWidget(MaterialApp(home: Scaffold(body: UserCard(user: user))));
await tester.tap(find.byType(UserCard));
await tester.pumpAndSettle();
expect(find.byType(UserDetailPage), findsOneWidget);
});
}
class MockUserRepository extends Mock implements UserRepository {}
final mockRepository = MockUserRepository();
// Setup mock behavior
when(mockRepository.getUser('1')).thenAnswer((_) async => User(...));
// Verify calls
verify(mockRepository.getUser('1')).called(1);
// Capture arguments
final captured = verify(mockRepository.updateUser(captureAny)).captured;
void main() {
group('User Creation Flow', () {
testWidgets('Create user and verify', (tester) async {
await tester.pumpWidget(const MyApp());
// Navigate to create user
await tester.tap(find.text('Add User'));
await tester.pumpAndSettle();
// Fill form
await tester.enterText(find.byKey(Key('nameField')), 'John');
await tester.enterText(find.byKey(Key('emailField')), 'john@example.com');
// Submit
await tester.tap(find.text('Create'));
await tester.pumpAndSettle();
// Verify result
expect(find.text('User created'), findsOneWidget);
});
});
}
Ensure bulletproof quality with comprehensive testing.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.