custom-plugin-flutter-skill-testing
1600+ lines of testing mastery - unit tests, widget tests, integration tests, E2E, coverage, mocking with production-ready code examples.
What this skill does
# custom-plugin-flutter: Testing & QA Skill
## Quick Start - Complete Test Suite
```dart
// 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);
});
});
}
```
## 1. Unit Testing
```dart
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,
);
});
});
}
```
## 2. Widget Testing
```dart
void main() {
testWidgets('Render user card', (tester) async {
const user = User(id: '1', name: 'John Doe', email: '[email protected]');
await tester.pumpWidget(
MaterialApp(home: Scaffold(body: UserCard(user: user))),
);
expect(find.text('John Doe'), findsOneWidget);
expect(find.text('[email protected]'), findsOneWidget);
});
testWidgets('Tap user card navigates', (tester) async {
const user = User(id: '1', name: 'John Doe', email: '[email protected]');
await tester.pumpWidget(MaterialApp(home: Scaffold(body: UserCard(user: user))));
await tester.tap(find.byType(UserCard));
await tester.pumpAndSettle();
expect(find.byType(UserDetailPage), findsOneWidget);
});
}
```
## 3. Mocking
```dart
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;
```
## 4. Integration Testing
```dart
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')), '[email protected]');
// Submit
await tester.tap(find.text('Create'));
await tester.pumpAndSettle();
// Verify result
expect(find.text('User created'), findsOneWidget);
});
});
}
```
---
**Ensure bulletproof quality with comprehensive testing.**
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.