runTest method

  1. @override
Future<void> runTest(
  1. Future<void> testBody(),
  2. VoidCallback invariantTester, {
  3. String description = '',
  4. @Deprecated('This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' 'This feature was deprecated after v2.6.0-1.0.pre.') Duration? timeout,
})
override

Call the testBody inside a FakeAsync scope on which pump can advance time.

Returns a future which completes when the test has run.

Called by the testWidgets and benchmarkWidgets functions to run a test.

The invariantTester argument is called after the testBody's Future completes. If it throws, then the test is marked as failed.

The description is used by the LiveTestWidgetsFlutterBinding to show a label on the screen during the test. The description comes from the value passed to testWidgets.

Implementation

@override
Future<void> runTest(
  Future<void> Function() testBody,
  VoidCallback invariantTester, {
  String description = '',
  @Deprecated(
    'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
    'This feature was deprecated after v2.6.0-1.0.pre.'
  )
  Duration? timeout,
}) async {
  await super.runTest(
    testBody,
    invariantTester,
    description: description,
  );
  results[description] ??= _success;
}