widget_test_harness library

Classes

CommonTester
abstraction so mixins can be written to support dart tests and widget tests uses pump, pumpAndSettle, and idle in widget tests. Uses Future.value and Future.microtask for unit tests
FlutterTestHarness
Base class for UnitTestHarness and WidgetTestHarness intended for mixins to conform to build up testing feature dependencies see NetworkImageMixin for example
Given<T extends FlutterTestHarness>
Given class used to setup the test.
GWTBase<T extends FlutterTestHarness>
base class for Given, When, Then.
HarnessSetup<H extends FlutterTestHarness>
Used to generate a function that has the callback with the appropriate given,when,then Provides common setup functionality that mixins can use
PublicGiven<T extends FlutterTestHarness>
PublicThen<T extends FlutterTestHarness>
PublicWhen<T extends FlutterTestHarness>
Then<T extends FlutterTestHarness>
Then class used for asserting behavior
UnitCommonTester
UnitTestHarness
class to subclass for any test that does not take a WidgetTester use HarnessSetup.setupHarness to create a harness then pass it into the body of a test
When<T extends FlutterTestHarness>
When class used for when user performs action or something happens in the system
WidgetCommonTester
WidgetTestHarness
class to subclass for any test that takes a WidgetTester

Mixins

NetworkImageMixin
mixin to provide support for loading images instead of throwing an error provides support to load arbitrary images based on the uri
SemanticTesterMixin
Add to harness to support semantic testing Handles the setup/teardown

Typedefs

ClassHarnessCallback<T extends FlutterTestHarness> = Future<void> Function(PublicGiven<T>, PublicWhen<T>, PublicThen<T>)
This function is used to generate a function to pass into a unit test From there you can use the Given, When, Then to compose the test case
WidgetTesterReturn = Future<void> Function(WidgetTester tester)