on

abstract fun on(aggregateId: String = generateGlobalId(), tenantId: String = TenantId.DEFAULT_TENANT_ID, stateAggregateFactory: StateAggregateFactory = ConstructorStateAggregateFactory, eventStore: EventStore = InMemoryEventStore(), serviceProvider: ServiceProvider = SimpleServiceProvider(), block: GivenDsl<S>.() -> Unit)

Starts a new test scenario for an aggregate.

This method initializes a test context with the specified parameters and executes the test scenario defined in the block. Each call to on creates an independent test scenario that can be run in parallel.

Parameters

aggregateId

the unique identifier for the aggregate (auto-generated if not specified)

tenantId

the tenant identifier for multi-tenant scenarios (defaults to system tenant)

stateAggregateFactory

factory for creating aggregate state instances

eventStore

the event store to use for event sourcing (defaults to in-memory store)

serviceProvider

provider for dependency injection during testing

block

the test scenario definition using GivenDsl