Introduction and example on Flutter Integration Testing
integrationtestapp
Flutter Project with integration test example.
Setup integration test
-
Add dependency in pubspec.yml
dev_dependencies:
integration_test:
sdk: flutter
flutter_test:
sdk: flutter -
Create “integration_test” directory if not present.
integrationtestapp
|
|__integration_test
|__lib -
Initialize singleton service inside the test file inside main()
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
- Use widgetTester to interact and test
Run test
-
Connect a device or use Emulator/Simulator
-
To run a single test file
flutter test integration_test\file_name.dart
- To run all the test files
flutter test integration_test
Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.