ensemble_test_runner library
Public API for running declarative tests against Ensemble apps.
Use runEnsembleTests to execute a discovered suite from a Flutter
test, or use EnsembleTestParser and the model types for tooling that needs
to inspect or build test definitions. The ensemble_test executable is the
recommended command-line entry point for application developers.
Classes
- ActionResult
- Result of TestExecutionSession.act.
- APICallRecord
- Diagnostic record for one API invocation observed during a test.
- ApiCallRecorder
- In-memory API call collection used by reports and assertions.
- ApiMockingTestService
- ApiTestService
- API observation/mocking optionally exposed by an application.
- ApplicationCheckpointDriver
-
Optional application-owned support for YAML
session:dependencies. - ApplicationTestDriver
- Application-owned lifecycle used by pure Flutter and mixed applications.
- ApplicationTestServices
- Typed capabilities exposed by the launched application.
- ArtifactRequest
- Request to capture a diagnostic artifact.
- AssertionEngine
- AssertionResult
-
AttemptStateApplicationTestDriver<
TState> - Optional capability for drivers that can launch from shared attempt state.
- ElementBounds
- A rectangular region used to narrow a target when labels are ambiguous.
- ElementLocator
- A semantic or structural description of an element in the current view.
- ElementTarget
- Identifies an element either from an observation or through a locator.
- EnsembleSingleTestResult
- Result for one executed declarative test case. Result and diagnostics for one expanded test case run.
- EnsembleTestAppTarget
-
Local app target resolved from
definitions.localinensemble/ensemble-config.yaml. - EnsembleTestCase
- Parsed definition of a single declarative test case.
- EnsembleTestConfig
-
Suite-wide configuration loaded from
tests/config.yaml. - EnsembleTestContext
- EnsembleTestDiscovery
- Discovers declarative tests and app settings from the host Flutter app bundle.
- EnsembleTestEnvironment
- Environment overrides applied to a test run.
- EnsembleTestHarness
- Boots the real Ensemble runtime for widget tests.
- EnsembleTestOptions
-
Options for runEnsembleTests, typically set from
test/ensemble_tests.dart. - EnsembleTestParser
- Parses test cases and suite configuration from test documents.
- EnsembleTestPlanRunResult
- EnsembleTestReportDetails
- Human-readable run metadata for console reports (see TestReporter).
- EnsembleTestRunner
- Executes parsed Ensemble test plans against a widget tester.
- EnsembleTestRunRequest
- Request object describing an Ensemble test run.
- EnsembleTestRunResult
- Aggregate result for a test run. Aggregate result for one complete runner invocation.
- EnsembleTestRuntimeAdapter
- Execution-environment behavior used by the shared Ensemble harness.
- EnsembleTestSchemaBuilder
-
Builds JSON Schema for app-local
tests/*.test.yamlfiles. - EnsembleTestSetup
- Per-test bootstrap data applied before the widget tree mounts.
- HtmlTestReporter
- Writes the HTML report shell; the runner stores current run data in SQLite.
- IntegrationTestRuntimeAdapter
- JunitTestReport
- Serializes the machine-readable JUnit view of a completed suite.
- LocalTestExecutionSession
- Local TestExecutionSession over WidgetTester.
- LogApiCallsConfig
- Controls writing the per-test API call log artifact.
- LogStorageConfig
- Controls writing the final local storage snapshot to an artifact.
- MockAPIResponse
- Mock API response returned by the test HTTP provider. A deterministic API response used by the test provider.
- Navigation state optionally exposed by an application.
- ObservationCompleteness
- What fields were actually populated in this observation.
- ObservationOptions
- Options for TestExecutionSession.observe.
- PerformanceConfig
- Controls suite-level application performance logging.
- RuntimeMetadataService
- Optional application/runtime metadata for observations and reports.
- ScreenLaunchApplicationTestDriver
- Opt-in marker for drivers that interpret YAML EnsembleTestCase.startScreen.
- ScreenObservation
- Active screen / navigation slice of a UiObservation.
- ScreenshotConfig
- Controls automatic per-step screenshot capture and filtering.
- SessionCapabilities
- What a session adapter can honestly provide.
- SessionPermissions
- What a caller is allowed to invoke on a session.
- SourceLocation
- Location in the authored test, independent of the parser and Flutter.
- StandaloneEnsembleApplicationHandle
- StandaloneEnsembleTestDriver
- Lifecycle adapter that boots a standalone Ensemble application through the shared attempt lifecycle and runtime contracts.
- StandaloneTestSessionFactory
- Standalone session factory for Flutter test contexts.
- StorageTestService
- Storage fixture operations explicitly owned by an application.
- TestApiOverlay
-
Delegates to a real provider unless
hosthas a test override for the API name. - TestApiProviderOverlay
- Test provider overlay: observes API calls, applies test overrides, otherwise delegates. HTTP provider that applies test mocks and delegates all other calls.
- TestApplicationHandle
- The launched application instance. This is not an execution session.
- TestArtifact
- Captured artifact metadata (bytes live outside the JSON contract).
- TestDeviceTarget
- One device (+ optional locale/theme) in a suite run matrix.
- TestExecutionConfig
- Timing defaults for TestStepExecutor (overridable per executor instance).
- TestExecutionSession
- Interface for one isolated app test execution (observe / act / wait / assert).
- TestFailureDetails
- TestIntegrationRegistration
- Registration hook for optional test-runtime integrations.
- TestLaunchContext
- Attempt-scoped information supplied to an ApplicationTestDriver.
- TestLogger
- Simple in-memory logger for test runs.
- TestMocks
- Mock configuration attached to a test case. API mocks attached to a test after profile and suite composition.
- TestOperation
- The only command representation between a compiled plan and its runtime.
- TestProfile
- A named profile containing reusable mocks and initial state.
- TestReporter
- TestScenario
- One scenario from a scenario-based test suite.
- TestServiceConfig
- A local process that the runner starts before executing tests.
- TestSessionConfiguration
- Configuration for creating a TestExecutionSession.
- TestSessionFactory
- Abstract factory for standalone sessions.
- TestStep
- Single executable step from a declarative test file.
- TestStepDefinition
- TestStepRegistry
- TestStepRegistryEntry
- Single source of truth for declarative test steps (metadata + JSON Schema args).
- TestStepVocabulary
- Canonical step names, aliases, and JSON Schema args.
- TestSuiteContext
- Suite-scoped information supplied to an ApplicationTestDriver.
- TestSuiteSource
- One resolved suite source shared by CLI patching, validation and runtime.
- TimerRewriteConfig
- Controls timer normalization used by the Flutter test host.
- UiBounds
- Axis-aligned bounds in logical pixels.
- UiElement
- One rendered element in a UiObservation.
- UiElementState
- UiObservation
- Serializable snapshot of the currently rendered UI.
- UiObserver
- Collects a serializable UiObservation of the live UI.
- UiViewport
- Viewport size for the observation.
- WaitResult
- WidgetTestRuntimeAdapter
- WifiTestConfig
-
Suite Wi-Fi test double settings from
tests/config.yaml.
Enums
- ActionStatus
- AssertionStatus
- ExecutionMode
- Host environment used to execute a declarative test suite.
- ObservationDetailLevel
- Controls how much UI state an observation is allowed to collect.
- ObservationSynchronization
- How far to synchronize before capturing a UiObservation.
- OperationKind
- TestApplicationLaunchKind
- How a YAML suite obtains the application under test.
- TestExecutionErrorCode
- Structured error codes for TestExecutionSession leaf operations.
- TestFailureKind
- TestStatus
- Status of a finished test case. Final status of an executed test case.
- TestStepArgKind
- Argument shape for a declarative test step (JSON Schema for editor validation).
- TestStepCategory
- TestStepControlKind
- The specific plan node represented by a control-flow step.
- TestStepExecutionKind
- Execution route class generated for every declarative test step.
- TestStepTier
- WaitStatus
Extensions
Functions
-
applyTestBootstrap(
EnsembleConfig config, EnsembleTestSetup setup) → Future< void> -
Applies test environment and storage bootstrap data to
config. -
applyTestStorageBootstrap(
EnsembleTestSetup setup) → Future< void> -
buildAgentLocatorCandidates(
UiElement element, {ElementLocator? parentScope, int? iconOccurrenceAmongSiblings, int? iconSiblingCount}) → List< ElementLocator> - Report locator candidates in preference order.
-
buildTestReportDetails(
EnsembleTestCase testCase, {List< int> stepDurationsMs = const [], List<String> stepStartTimes = const [], Map<String, Map< screens = const {}, }) → EnsembleTestReportDetailsString, dynamic> > -
cheapSuggestedLocator(
UiElement element, {ElementLocator? parentScope, int? iconOccurrenceAmongSiblings, int? iconSiblingCount, int? occurrenceAmongSiblings}) → ElementLocator? - First preferred candidate for diagnostic / report snapshots (no finder).
-
collectScreensVisited(
String effectiveStart, {}) → List< String> -
containerScopeLocator(
UiElement element) → ElementLocator? -
within=scope for descendants — includes non-tappable cards/toasts. -
enrichSuggestedLocators(
{required UiObservation observation, required FlutterTargetResolver resolver, required ObservationRegistry registry}) → UiObservation - Attaches verified UiElement.suggestedLocator values using the live resolver.
-
ensureHostFixturesSupported(
EnsembleTestContext context, {ApplicationTestServices? services, bool requireResolved = false}) → void - Rejects YAML mocks/fixtures that cannot attach to the application under test.
-
flattenTestSteps(
Iterable< TestStep> steps) → List<TestStep> - Flattens authored steps in the same pre-order used by report outlines and compiled plan step boundaries. Control rows are included so nested step indexes remain stable even when a branch is skipped.
-
formatStepBrief(
TestStep step) → String -
Short label for a step, e.g.
expectVisible(greeting_text). -
formatStepOutlineLine(
String label, int? durationMs) → String - Pure-Dart helpers for rendering step outlines with optional durations.
-
formatSuggestedSelector(
ElementLocator locator) → String - Compact YAML-mappable form of an ElementLocator for observer output.
-
hostProcessServiceConfigs(
List< TestServiceConfig> configured, {bool hostOwnsServices = const bool.fromEnvironment('ensembleTestHostOwnsServices')}) → List<TestServiceConfig> - Services started inside the test process.
-
installTestEncryptionKey(
) → void - Installs the per-run test encryption key and clears the cached key.
-
isEnsembleTestParallelWorker(
) → bool - True when this Flutter test process is a parallel CLI worker shard.
-
mapObservationLocatorTree(
{required List< UiElement> elements, required ObserverLocatorResolver resolve}) → List<UiElement> - Applies locator resolution to a tree while consistently deriving scopes and sibling occurrences for both live and diagnostic observations.
-
outlineSteps(
List< TestStep> steps) → List<String> -
registerApplicationTests(
{required ApplicationTestDriver driver, required ExecutionMode mode, String? testsAssetPrefix}) → Future< void> - Registers a host suite after the caller selected the Flutter test binding.
-
reportSuiteEndWithStorageRestore(
{Object? suiteError, StackTrace? suiteStackTrace, Object? storageRestoreError}) → void - Surfaces storage-restore failures as suite infrastructure failures.
-
runApplicationIntegrationTests(
{required ApplicationTestDriver driver, String? testsAssetPrefix}) → Future< void> - Registers an application suite with the integration-test binding.
-
runApplicationTestPlan(
{required ApplicationTestDriver driver, required EnsembleTestExecutionPlan plan, required WidgetTester tester, required ExecutionMode mode, Map< String, String> serializedPlans = const {}, SuiteCaseStart? onTestStart, SuiteCaseProgress? onTestComplete}) → Future<EnsembleTestRunResult> - Executes an already-resolved plan through an application driver.
-
runApplicationTests(
{required ApplicationTestDriver driver, String? testsAssetPrefix}) → Future< void> - Registers and executes declarative tests against an application-provided driver.
-
runEnsembleIntegrationTests(
{Future< void> bootstrap()?, Map<String, Function> ? externalMethods}) → Future<void> -
runEnsembleTests(
{Future< void> bootstrap()?, Map<String, Function> ? externalMethods}) → Future<void> -
stepOutlineDisplayLines(
{required List< String> stepsOutline, List<int> stepDurationsMs = const [], int? failedStepIndex}) → Iterable<({int? durationMs, bool failed, String text})> -
Walks
stepsOutlinewithstepDurationsMs/failedStepIndexfor display.
Typedefs
-
EnsembleTestProgressListener
= FutureOr<
void> Function(EnsembleTestDefinition definition, EnsembleSingleTestResult result) - EnsembleTestRunOutput = ({EnsembleConfig config, EnsembleTestContext context, EnsembleSingleTestResult result})
- The value returned by one complete test execution, including its runtime context. Keeping this record next to retry aggregation makes the retry boundary independent from the runner's orchestration implementation.
- ObserverLocatorResolution = ({ElementLocator? locator, String? warning})
- ObserverLocatorResolver = ObserverLocatorResolution Function({required UiElement element, int? iconOccurrenceAmongSiblings, int? iconSiblingCount, int? occurrenceAmongSiblings, ElementLocator? parentScope})
Exceptions / Errors
- ApplicationTestCrash
- EnsembleTestFailure
- Thrown when a test step or assertion fails. Exception used for user-facing test and assertion failures.
- TestExecutionError
- Machine-readable failure for observe/act/wait/assert results.
- UnsupportedApplicationCapability