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

**URL:** <https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130>\
**Category:** Community Support\
**Tags:** go-sdk, testing\
**Created:** [March 7, 2022, 5:48pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130 "2022-03-07T17:48:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmurph](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kmurph](https://community.temporal.io/u/kmurph)\
**Post date:** [March 7, 2022, 5:48pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130/1 "2022-03-07T17:48:02Z")

</div>

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?

```auto
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

thanks!

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 7, 2022, 6:30pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130/2 "2022-03-07T18:30:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kmurph](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kmurph](https://community.temporal.io/u/kmurph)\
**Post date:** [March 10, 2022, 5:59pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130/3 "2022-03-10T17:59:34Z")

</div>

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?

```auto
  s.env.SetStartWorkflowOptions(internal.StartWorkflowOptions{
    ID: MOCK_WORKFLOW_ID,
  })

  s.env.ExecuteWorkflow(
    someWorkflow, 
   SomeWorkflowInputs{},
  )

```

Thanks!

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 10, 2022, 7:26pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130/4 "2022-03-10T19:26:05Z")

</div>

Use [client.StartWorkflowOptions](https://github.com/temporalio/sdk-go/blob/c453756356db4e5ae9fcabd416a6a8e57db5cc35/client/client.go#L67) type alias.

---

<div class="post-metadata">

**Author:** ![kmurph](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kmurph](https://community.temporal.io/u/kmurph)\
**Post date:** [March 10, 2022, 9:34pm UTC](https://community.temporal.io/t/go-sdk-test-setup-inject-manual-workflowid-into-s-env-executeworkflow-call/4130/5 "2022-03-10T21:34:32Z")

</div>

awesome, that did it.  
Thanks!
