Mocking parent and childworkflows

Hello Guys,

I have a parent workflow which creates two child workflow on signaling.
Each child workflow has 2 activities.

Currently, when I mock activity (for completion signal) and workflow using s.env.OnActivity & s.env.OnWorkflow, it looks like the first child workflow is being mocked successfully.

When I try to use second s.env.OnActivity & s.env.OnWorkflow, it does not have any affect.

How do I make sure that the parent workflow waits for both child work and its activities so that I can test/mock various scenarios i.e. child workflow activities (success and failures)?

Thank you.

It’s possible the second workflow is not being matched by the mock. Can you show code (ideally small and standalone that we can run/debug) where the mock is not applying?

Thank you for your reply. When I comment out mocking workflow using s.env.OnWorkflow , I find that both the underlying child workflows fails i.e. the application logs error interface conversion: interface {} is nil, not models.CustomContext

When I mock it, it seems one mock is sufficient for both child workflows (somehow). I have to simply the code before I can put out code here.

thank you

Are the child workflows the same name? If so, yes, the mock will be reused and it depends on return details and how you setup the mock. “OnWorkflow” is essentially mock package - - with some wrappers and lookup helpers.

Okay. Thank you for the explanation. The child workflow is generic name i.e. DSLWorkflow which takes different dsl files.