Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide way to populate activity execution context for activity unit tests #2034

Open
madhav2302 opened this issue Apr 11, 2024 · 0 comments
Labels
enhancement User experience

Comments

@madhav2302
Copy link

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

@madhav2302 madhav2302 added the enhancement User experience label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement User experience
Projects
None yet
Development

No branches or pull requests

1 participant