run<T> method
Future<T>
run<T>({
- required WidgetTester tester,
- required TestServiceManager services,
- required ApplicationTestDriver driver,
- required TestSuiteContext context,
- required Future<
T> execute(- void registerCleanup(
- FutureOr<
void> ()
- FutureOr<
- void registerCleanup(
Implementation
Future<T> run<T>({
required WidgetTester tester,
required TestServiceManager services,
required ApplicationTestDriver driver,
required TestSuiteContext context,
required Future<T> Function(
void Function(FutureOr<void> Function()) registerCleanup,
) execute,
}) {
final cleanup = AsyncCleanupStack();
// An empty service set cannot own a process. Avoid registering and
// invoking a no-op stop path for the common application suite, while
// retaining the cleanup guard for configured services that may partially
// start before setup fails.
if (services.hasConfiguredServices) {
cleanup.add(() => LiveAsyncCallSupport.run<void>(services.stopAll));
}
return cleanup.run(() async {
if (services.hasConfiguredServices) {
await tester.runAsync(services.startAll);
}
return const ApplicationSuiteLifecycle().run(
application: driver,
context: context,
cleanup: cleanup,
execute: () => execute(cleanup.add),
);
});
}