-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Currently testWidgets is providing WidgetTester as the solution for driving the test.
WidgetTester is a good infrastructure for unit test, but may have been too complicated and at a too high level for implementing all the tests we need. Meanwhile we have LiveWidgetController which is a minimal implementation for WidgetController and is used internally in flutter_driver.
WidgetController may be a better interface for controlling the app on performance/integration test:
WidgetControlleris the base class, meaning the testing code will be able to run for all our current testing tools:flutter_test/WidgetTester,flutter_drive,e2eor even the real release app. This will be extremely helpful for running shader warmup on the user's device.- This is feasible because extra features provided by
WidgetTesterand its test bindings, except for some convenience wrap of driving a test, are most likely not necessary, and sometimes even harmful (e.g. Add a newLiveTestWidgetsFlutterBindingFramePolicyfor benchmark on device #60739) for performance test.
One way to implement it is to provide a testWidgets alternative, which restrict its callback to only use WidgetController rather than WidgetTester. Meanwhile, some wraps of driving the test provided by WidgetTester should not have difficulties promoted to WidgetController, e.g. WidgetTester.ensureVisible.