TestingEnv : Workflow Already started Error

I am trying to setup the jest to test workflows using the test env setup in the Temporal Test suite docs. While developing the test script I kept hitting Workflow Already started Error. It looks like it still has the older workflows that might have been in running state while my test script errored out while I was developing the script. How do I clear the older worflows out before each start ?

Hi @Vineeth_Palani

I guess it can happen if a workflow of some previous test with the same workflow id is still open/running. Can you try setting a unique workflowId to each workflow?

Antonio

Thanks Antonio. will try that out. Is there a way to see or some file that we can delete or clear so that the workflows dont resume next time it runs. This would only be a problem when we are developing the test scripts

Hi @Vineeth_Palani

I guess what you want is to have a clean execution for each unit test right?

Is there a way to see or some file that we can delete or clear so that the workflows dont resume next time it runs

I guess you could delete the workflow execution before/after each unit test
testEnv.client.workflowService.deleteWorkflowExecution() or start a new server/clean test server for each unit test.

Antonio