You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been developing a few durable functions, and I've come to realize that there is no real way to mock a azure.durable_functions.DurableOrchestrationContext object. It would be ideal if we could have this available to unit test durable functions. The current documentation seems to expect the developer to just run a local integration test.
What kinds of usage do you expect to see in this feature?
Per above, mocking the orchestration context would allow unit-testing of durable functions.
💭 Describe alternatives you've considered
What are other ways to achieve this? Have you thought of alternative designs or solutions?
For now, I am resorting to just defining test classes that perform the core actions of my durable functions without requiring a context object. These test classes interface with Azurite to mock up necessary containers.
Any existing workarounds? Why are they not sufficient? We'd like to know!
This was rather naive, but I tried debugging a manual integration test and copying the context's json string, then feeding it to the client constructor in my unit testing. I will note that this would not even work in theory, since the context json values are tied to dynamically created resources.
Additional context
Add any other context or screenshots about the feature request here.
Question: what is the current guidance for testing durable functions, besides manually performing an integration test?
Question: is the following approach valid to emulate unit-testing: refactoring logic that does not require a context to separate classes so that they are accessible for unit-testing?
The text was updated successfully, but these errors were encountered:
💡 Feature description
I've been developing a few durable functions, and I've come to realize that there is no real way to mock a
azure.durable_functions.DurableOrchestrationContext
object. It would be ideal if we could have this available to unit test durable functions. The current documentation seems to expect the developer to just run a local integration test.Per above, mocking the orchestration context would allow unit-testing of durable functions.
💭 Describe alternatives you've considered
For now, I am resorting to just defining test classes that perform the core actions of my durable functions without requiring a context object. These test classes interface with Azurite to mock up necessary containers.
This was rather naive, but I tried debugging a manual integration test and copying the context's json string, then feeding it to the client constructor in my unit testing. I will note that this would not even work in theory, since the context json values are tied to dynamically created resources.
Additional context
Question: what is the current guidance for testing durable functions, besides manually performing an integration test?
Question: is the following approach valid to emulate unit-testing: refactoring logic that does not require a context to separate classes so that they are accessible for unit-testing?
The text was updated successfully, but these errors were encountered: