Hi guys,
I’m trying to use a test suite for verifying the workflows and activities input and output. Regarding Activities I was able to verify inputs by using method env.onActivity but I was not able to test output. Is it possible to call an activity, really execute it and test the related result? I did not find an example in the go ask sample repository regarding this.
Could you suggest me an approach?
Great thanks Maxim,
I successfully used the suggested method and all works fine.
A last question about the topic: could you confirm that the test suite requires the temporal server up and running and that there is no possibility to test and mock without it?
Thanks in advance.
Marco
Hi @maxim, I am trying to test workflow using testsuite.TestWorkflowEnvironment.
I am able to test activities for errors using OnActivity().Return() by returning errors. But when i use the similar OnActivity().Return() for response with nil error, i am not able to see the value from response in the actual workflow.
sample activity call in workflow :
var response string
err = workflow.ExecuteActivity(ctx, SampleActivity).Get(ctx, &response)
if err != nil {
workflow.GetLogger(ctx).Error("SampleActivity failed with ", err)
return err
}
i am not able to see the value from response in the actual workflow.
Can you clarify this? What is response after ExecuteActivity is invoked there or otherwise what error is happening during run? Also, you don’t have to do a callback, .Return("test_string", nil) should be acceptable.
(if easier, you might want to make a new forum post instead of reusing this older one)