Documentation
¶
Index ¶
- type ActorTemporalScenario
- func (s *ActorTemporalScenario) Advance(d time.Duration) *ActorTemporalScenario
- func (s *ActorTemporalScenario) Env() *testsuite.TestWorkflowEnvironment
- func (s *ActorTemporalScenario) ExpectActivityOptions(name string, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario
- func (s *ActorTemporalScenario) ExpectActivityOptionsForPayload(payload any, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario
- func (s *ActorTemporalScenario) QueryWorkflow(payload any) (converter.EncodedValue, error)
- func (s *ActorTemporalScenario) Run(t testing.TB) TemporalOutcome
- func (s *ActorTemporalScenario) Then(asserts ...TemporalAssertion) *ActorTemporalScenario
- func (s *ActorTemporalScenario) WhenActivity(nameOrFn interface{}, fnOpt ...interface{}) *ActorTemporalScenario
- func (s *ActorTemporalScenario) WhenActivityForPayload(payload any, fn interface{}) *ActorTemporalScenario
- func (s *ActorTemporalScenario) WhenCommand(payload any) *ActorTemporalScenario
- type TemporalAssertion
- type TemporalOutcome
- type TemporalScenario
- func (s *TemporalScenario) Advance(d time.Duration) *TemporalScenario
- func (s *TemporalScenario) Env() *testsuite.TestWorkflowEnvironment
- func (s *TemporalScenario) Run(t testing.TB) TemporalOutcome
- func (s *TemporalScenario) Then(asserts ...TemporalAssertion) *TemporalScenario
- func (s *TemporalScenario) When(name string, payload any) *TemporalScenario
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorTemporalScenario ¶
type ActorTemporalScenario struct {
// contains filtered or unexported fields
}
ActorTemporalScenario wraps TemporalScenario for actor descriptions.
func NewActorTemporalScenario ¶
func NewActorTemporalScenario(actor actors.Actor, id string, init any) *ActorTemporalScenario
NewActorTemporalScenario constructs a TemporalScenario backed by the given actor.
func (*ActorTemporalScenario) Advance ¶
func (s *ActorTemporalScenario) Advance(d time.Duration) *ActorTemporalScenario
Advance advances the Temporal clock.
func (*ActorTemporalScenario) Env ¶
func (s *ActorTemporalScenario) Env() *testsuite.TestWorkflowEnvironment
Env exposes the underlying TemporalScenario environment for additional setup.
func (*ActorTemporalScenario) ExpectActivityOptions ¶
func (s *ActorTemporalScenario) ExpectActivityOptions(name string, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario
ExpectActivityOptions asserts the merged Temporal options for an activity name.
func (*ActorTemporalScenario) ExpectActivityOptionsForPayload ¶
func (s *ActorTemporalScenario) ExpectActivityOptionsForPayload(payload any, assert func(testing.TB, actors.ActivityCallOptions)) *ActorTemporalScenario
ExpectActivityOptionsForPayload asserts merged options using the payload type to resolve the activity name.
func (*ActorTemporalScenario) QueryWorkflow ¶
func (s *ActorTemporalScenario) QueryWorkflow(payload any) (converter.EncodedValue, error)
QueryWorkflow executes a typed query against the workflow.
func (*ActorTemporalScenario) Run ¶
func (s *ActorTemporalScenario) Run(t testing.TB) TemporalOutcome
Run executes the scenario.
func (*ActorTemporalScenario) Then ¶
func (s *ActorTemporalScenario) Then(asserts ...TemporalAssertion) *ActorTemporalScenario
Then registers assertions.
func (*ActorTemporalScenario) WhenActivity ¶
func (s *ActorTemporalScenario) WhenActivity(nameOrFn interface{}, fnOpt ...interface{}) *ActorTemporalScenario
WhenActivity overrides a registered activity. Accepts either (name, fn) or a typed func(context.Context, Payload) to infer the name from the payload type.
func (*ActorTemporalScenario) WhenActivityForPayload ¶
func (s *ActorTemporalScenario) WhenActivityForPayload(payload any, fn interface{}) *ActorTemporalScenario
WhenActivityForPayload overrides an activity by inferred payload type.
func (*ActorTemporalScenario) WhenCommand ¶
func (s *ActorTemporalScenario) WhenCommand(payload any) *ActorTemporalScenario
WhenCommand sends a typed command to the workflow.
type TemporalAssertion ¶
type TemporalAssertion func(testing.TB, TemporalOutcome)
TemporalAssertion inspects the workflow outcome.
type TemporalOutcome ¶
type TemporalOutcome struct {
Env *testsuite.TestWorkflowEnvironment
Error error
}
TemporalOutcome captures workflow execution artifacts for assertions.
type TemporalScenario ¶
type TemporalScenario struct {
// contains filtered or unexported fields
}
TemporalScenario orchestrates a real Temporal workflow inside the Temporal testsuite environment using a declarative step API.
func NewTemporalScenario ¶
func NewTemporalScenario(wf interface{}, args ...any) *TemporalScenario
NewTemporalScenario constructs a scenario for the provided workflow.
func NewTemporalScenarioWithOptions ¶
func NewTemporalScenarioWithOptions(workflowFn interface{}, opts workflow.RegisterOptions, args ...any) *TemporalScenario
NewTemporalScenarioWithOptions registers the workflow using Temporal register options.
func (*TemporalScenario) Advance ¶
func (s *TemporalScenario) Advance(d time.Duration) *TemporalScenario
Advance moves the fake clock forward deterministically.
func (*TemporalScenario) Env ¶
func (s *TemporalScenario) Env() *testsuite.TestWorkflowEnvironment
Env exposes the underlying TestWorkflowEnvironment for additional setup.
func (*TemporalScenario) Run ¶
func (s *TemporalScenario) Run(t testing.TB) TemporalOutcome
Run executes the scenario and returns the outcome.
func (*TemporalScenario) Then ¶
func (s *TemporalScenario) Then(asserts ...TemporalAssertion) *TemporalScenario
Then registers assertions executed after workflow completion.
func (*TemporalScenario) When ¶
func (s *TemporalScenario) When(name string, payload any) *TemporalScenario
When schedules a signal (command) delivery.