Issues with testing async workflow activities #195
Unanswered
Roman77450
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, everyone!
We have a dynamic workflow system that allows our users to create their own workflows through a dedicated UI.
I have a class, AutomationHandler, which takes a list of user-defined activity groups (conditionGroups) as input. Each group is executed in parallel, but the activities inside the group are executed sequentially.
Each group contains activities of type Condition or Action. If all Condition activities return true, the Action activity is executed (e.g., sending an email).
Here’s a exemple of the workflow implementation:
I would like to write tests to verify that specific activities are triggered (or not) based on predefined data.
However, my issue is that my activities are not being triggered during tests. I suspect this might be related to the use of ActivityStub::async.
Should I also mock Workflow\AsyncWorkflow?
Here’s an example of a simplified unit test I wrote:
Unfortunately, the activities are not being executed as expected.
My goal:
I want to ensure that the correct activities are triggered based on predefined datasets.
Does anyone have insights on how to properly test this?
Should I mock additional components? Or is there something I’m missing with the way I’ve set up the workflow stubs?
Any guidance would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions