Skip to content

A testWidgets alternative working for lower level compatibility  #61511

@CareF

Description

@CareF

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:

  • WidgetController is the base class, meaning the testing code will be able to run for all our current testing tools: flutter_test/WidgetTester, flutter_drive, e2e or 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 WidgetTester and 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 new LiveTestWidgetsFlutterBindingFramePolicy for 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.

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions