Go-sdk: test setup - Inject manual workflowId into s.env.ExecuteWorkflow call

Hi there,
I’m trying to write tests for an activity that observes/queries another 2nd workflow.

Is there a way to manually populate the workflowId when initializing a workflow in a test environment?

s.env.ExecuteWorkflow(someWorkflow, InputType{
  someInputProp: "someInputValue",

The activity calls DescribeWorkflowExecution (with the specified workflowId) to check if it exists and get its status.

The workflowId for the 2nd workflow is manually supplied when created


Have you considered heartbeating instead of DescribeWorkflowExecution? It is a much cleaner way to learn about workflow completion.

You can use TestWorkflowEnvironment.SetStartWorkflowOptions to set the workflow ID.

Hi Maxim,
Thanks for the feedback.

I will look into using heartbeating to refactor this in the future.

In the meantime, I had a couple follow up question about using SetStartWorkflowOptions.

When I try to supply arguments to the method, it seems to want the arguments to be typed to the internal.StartWorkflowOptions type, which doesn’t appear to be doable/recommended.

How would I define this helper to avoid the internal problem?

Also, the setting is bound to the s.env scope, but not seeing how to associate the workflowOptions just with one workflow registered in the test. What would happen if I registered multiple workflows in the test?




Use client.StartWorkflowOptions type alias.

awesome, that did it.