run<T> method

Future<T> run<T>({
  1. required ApplicationTestDriver application,
  2. required TestSuiteContext context,
  3. required AsyncCleanupStack cleanup,
  4. required Future<T> execute(),
})

Implementation

Future<T> run<T>({
  required ApplicationTestDriver application,
  required TestSuiteContext context,
  required AsyncCleanupStack cleanup,
  required Future<T> Function() execute,
}) {
  // Register before setup: a driver may allocate resources before setup
  // reports an error, and must receive exactly one teardown opportunity.
  // The caller owns the suite stack so resources registered while executing
  // are released before the driver they depend on.
  cleanup.add(application.tearDownSuite);
  return () async {
    await application.setUpSuite(context);
    return execute();
  }();
}