Testing Flutter apps The goal of a widget test is to verify that the widget's UI looks and interacts as expected Testing a widget involves multiple classes and requires a test environment that provides the appropriate widget lifecycle context
Tap, drag, and enter text - Flutter Many widgets not only display information, but also respond to user interaction This includes buttons that can be tapped, and TextField for entering text To test these interactions, you need a way to simulate them in the test environment For this purpose, use the WidgetTester library
Find widgets - Flutter The find constant provided by the flutter_test package provides several ways to locate widgets in the test environment This recipe demonstrated three of these methods, and several more methods exist for different purposes
An introduction to unit testing - Flutter The test package provides the core framework for writing unit tests, and the flutter_test package provides additional utilities for testing widgets This recipe demonstrates the core features provided by the test package using the following steps:
Widget testing - Flutter Handle scrolling How to handle scrolling in a widget test Was this page's content helpful? Unless stated otherwise, the documentation on this site reflects Flutter 3 35 5 Page last updated on 2025-10-28 View source or report an issue
Handle scrolling - Flutter In this recipe, learn how to scroll through a list of items to verify a specific widget is being displayed, and the pros and cons of different approaches This recipe uses the following steps: Create an app with a list of items Write a test that scrolls through the list Run the test
Widget catalog - Flutter Create beautiful apps faster with Flutter's collection of visual, structural, platform, and interactive widgets In addition to browsing widgets by category, you can also see all the widgets in the widget index
Check app functionality with an integration test - Flutter The integration_test package lets you: Use the flutter drive command to run tests on a physical device or emulator Run on Firebase Test Lab, to automate testing on a variety of devices Use flutter_test APIs to write tests in a style similar to widget tests