Testing a Workflow that has an Infinite Loop to Run an Activity Periodically

In this scenario, a workflow has an infinite loop that runs an activity then sleeps for X amount of time. the activity updates the value of a variable inside the workflow. The variable would be queried from outside the workflow often. When testing the workflow in this scenario I used RegisterDelayedCallback before calling ExecuteWorkflow as per documentation. Now when I run the test, it hangs indefinitely (which is the expected behavior from this workflow). Is there a way to terminate the running workflow for testing purposes to avoid hanging indefinitely? Thanks.

You cannot have a workflow that just loops indefinitely as workflow history size is bounded by 50k events. You have to call continue as new periodically.

Thanks for your reply. The tests work properly now after I made the change.