Provide way to populate activity execution context for activity unit tests
Is your feature request related to a problem? Please describe.
I am writing unit tests for activity with TestActivityEnvironment, and using var workflowType = Activity.getExecutionContext().getInfo().getWorkflowType(); in my activity.
There is no way to populate this execution context for as of now other then creating a temporary workflow using TestWorkflowEnvironment and creating a sample workflow.
Ideally, I should be able to setup execution context for tests without any interactions with workflows.
Describe the solution you'd like Something like below would be nice.
TestActivityEnvironment.newInstance(TestEnvironmentOptions.newBuilder().setActivityExecutionContext(...).build())
Describe alternatives you've considered Setting up test environment workflow, which is very tedious for unit tests.
Additional context See https://temporalio.slack.com/archives/CTT84KXK9/p1712848268603179
@mfateev @cretz are there any plans to work on this? it will help with making tests easier.
Hrmm, yes, it is common in other SDKs to be able to populate activity info for tests. So I believe that this will be done, but no concrete timeline currently. We will look to prioritize.