- How do I simulate Activity failure in a Wokflow Unit test (Throwing some error from Activity mock)
Here is the mockito-exceptions document.
- How can I Simulate workflow Retry in Unit Test
Specify retry options when calling start workflow and then fail the workflow. Note that by default workflows don’t fail, but get stuck on an unknown exception. You can make workflow fail on certain exception types by specifying these types through
ImplementationOptions. In this example, it specifies Throwable as the exception type. So workflow will fail immediately on any exception.
Note that you usually do want your workflows to get stuck on unknown exceptions instead of failing. It allows deploying a fix to the problem without failing the workflows.
Workflow retries are usually a bad idea. It is better to write workflow in a way that it never fails.
- How can I Simulate activity Retry if an Activity fails in a workflow
It is already retried by the unit testing framework according to its retry policy.
- Is there a scope for simulating workflow failure?
I’m not sure I understand the question. You can always write a fake workflow that fails and let the client code handle the failure appropriately.