TestRuntime class final

A test-owned Runtime with event recording and deterministic cleanup.

Properties

activeExecutionIds Set<int>
Managed executions that have not reached physical completion.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether close has been requested through this harness.
no setter
observer RecordingRuntimeObserver
Ordered Runtime events emitted by this harness.
final
observerErrors List<RuntimeObserverError>
Immutable snapshot of observer callback failures.
no setter
runtime Runtime
Underlying long-lived Runtime.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
services Services
Boundary service access for test setup and assertions.
no setter

Methods

assertNoActiveExecutions() → void
Fail when any managed execution is still physically owned by the Runtime.
close({Duration gracePeriod = Duration.zero, bool interruptAfterGracePeriod = false}) Future<void>
Close the Runtime and dispose the event recorder.
execute<A extends Object, E extends Object>(Effect<A, E> effect, {String? label}) EffectExecution<A, E>
Start one managed execution.
executeWith<A extends Object, E extends Object>(Module module, Effect<A, E> effect, {String? label}) EffectExecution<A, E>
Start one execution with temporary providers and resources.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run<A extends Object, E extends Object>(Effect<A, E> effect, {String? executionLabel}) Future<ResultDart<A, E>>
Run one Effect and return its Result.
runExit<A extends Object, E extends Object>(Effect<A, E> effect, {String? executionLabel}) Future<Exit<A, E>>
Run one Effect while preserving every Exit case.
runExitWith<A extends Object, E extends Object>(Module module, Effect<A, E> effect, {String? executionLabel}) Future<Exit<A, E>>
Run one Effect with a temporary Module and preserve its Exit.
runWith<A extends Object, E extends Object>(Module module, Effect<A, E> effect, {String? executionLabel}) Future<ResultDart<A, E>>
Run one Effect with an execution-scoped Module.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

start(Module module, {ResolverBackend? backend, CleanupFailureObserver? cleanupFailureObserver, Iterable<RuntimeObserver> observers = const <RuntimeObserver>[], RuntimeObserverErrorHandler? observerErrorHandler, TestCleanupRegistrar? registerCleanup}) Future<TestRuntime>
Start a Runtime and automatically attach RecordingRuntimeObserver.
use<T extends Object>(Module module, FutureOr<T> body(TestRuntime testRuntime), {ResolverBackend? backend, CleanupFailureObserver? cleanupFailureObserver, Iterable<RuntimeObserver> observers = const <RuntimeObserver>[], RuntimeObserverErrorHandler? observerErrorHandler}) Future<T>
Start a harness, execute body, and close it even when body throws.