The flutter_test package
The flutter_test package is shipped with the Flutter SDK, is built on top of the test package, and provides a set of tools for helping us to write and run widget tests.
As said before, widget tests need to be executed in the widget environment and Flutter helps with this task with the WidgetTester class. This class encapsulates the logic for us to build and interact with the widget being tested and the Flutter environment.
We do not need to instantiate this class by ourselves as the framework provides the testWidgets() function. The testWidgets() function is similar to the Dart test() function seen before in Chapter 2, Intermediate Dart Programming, Writing unit tests section. The difference is the Flutter context, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access