Skip to content

A testWidgets alternative working for lower level compatibility  #61511

Closed

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.

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    on Jul 15, 2020
  2. self-assigned this
    on Jul 15, 2020
  3. CareF commented on Jul 15, 2020

    @CareF
    ContributorAuthor

    The idea credit to @liyuqian

  4. TahaTesser commented on Jul 15, 2020

    @TahaTesser
    Contributor

    Sounds like proposal for alternative, added proposal

  5. CareF commented on Jul 16, 2020

    @CareF
    ContributorAuthor
  6. added
    engineflutter/engine related. See also e: labels.
    on Jul 22, 2020
  7. github-actions commented on Aug 13, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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