What is the integration_test package used for?
Short Answer
integration_test runs your app as a whole on a real device or emulator, driving it through full user flows end-to-end — unlike widget tests, which run in a simulated environment without a real platform underneath.
Widget tests are fast but don't exercise real platform channels, real plugins, or actual device behavior. integration_test (Flutter's official successor to flutter_driver) runs your actual compiled app on a real or emulated device, using the same WidgetTester API as widget tests but backed by real app and platform integration — so a test can genuinely tap through login, fetch data, and navigate multiple real screens.
These tests are slower and more brittle than widget tests, so most teams use a testing pyramid: many unit tests, a good number of widget tests, and a smaller set of integration tests covering only the most critical user flows.
Common Mistakes
- ×Trying to replace all widget tests with integration tests — they're much slower and better reserved for a handful of critical end-to-end flows.
- ×Not accounting for real network/animation timing, leading to flaky integration tests.