TestRunner constructor

TestRunner({
  1. required Widget child,
  2. TestController? controller,
  3. bool? enabled,
  4. Key? key,
  5. Widget progressBuilder = const TestProgressBuilder(),
  6. TestableRenderController? testableRenderController,
  7. ThemeData? theme,
})

Constructs the runner. The child is the application to be tested.

The controller is used to perform the actual test executions as well as loading and saving tests. The controller may be null if, and only if, enabled is false.

Set enabled to false to disable the entire testing framework. If omitted the frameworl is enabled in debug and profile mode but disabled in release mode.

The progressBuilder is used to display test progress. This will default to the built in progress builder but can be overridden by applications to display the test progress in their own unique way.

The testableRenderController is used by the Testable widgets to determine how to render their UI and process user interactions.

If a theme is passed in then that will be used by the framework's built in pages and widgets.

Implementation

TestRunner({
  required this.child,
  TestController? controller,
  bool? enabled,
  Key? key,
  this.progressBuilder = const TestProgressBuilder(),
  TestableRenderController? testableRenderController,
  this.theme,
})  : assert(controller != null ||
          enabled == false ||
          (enabled == null && foundation.kReleaseMode == true)),
      _enabled = enabled ?? foundation.kReleaseMode != true,
      controller =
          (enabled ?? foundation.kReleaseMode != true) ? controller : null,
      _testableRenderController =
          testableRenderController ?? TestableRenderController(),
      super(key: key);