Test workflows
Learn how to test workflows in Flows.
Overview
Testing workflows is an essential step in ensuring your workflows run smoothly. Flows provides tools to validate and debug workflows before they are deployed.
How to test a workflow
Follow these steps to test your workflow:
- Publish to test environment: Publish the workflow in a test environment by clicking the Publish button in the workflow editor’s top-right corner.
- Log in to your application: Access your application in the test environment.
- Trigger the workflow: Trigger the workflow by meeting the start block conditions. This may involve creating a new user, updating a user property, or performing another action that triggers the workflow.
- Verify behavior: Confirm that the workflow executes as expected.
To simplify testing, set the workflow frequency to Every time
. This allows you to test
repeatedly without needing additional changes.
Using draft version
Flows allows you to apply the draft version of a workflow in an environment. This is useful for testing the workflow as you make changes without needing to publish a new version every time. To use the draft version in an environment:
- Click on Environments in the workflow editor.
- Using the Workflow version dropdown, apply the draft version to the desired environment.
- Save the changes.
Things to keep in mind when using the draft version:
- Never use the draft version in a production environment – as you make edits to your workflow the draft version can get into a broken state (eg. missing blocks, broken connections).
- It is easy to get stuck in an invalid state when using the draft version. Make sure to reset the workflow state for your test user if you get stuck.
Restart a workflow
If necessary, you can restart a workflow during testing. There are two methods to achieve this:
1. Publish a new version
When you publish a new version of a workflow, choose the Restart all in-progress users option. This resets the workflow for all users currently in progress.
2. Restart a single user
To restart for a specific user without publishing a new version:
- Navigate to the user’s profile.
- Switch to the Workflows tab.
- Click the Reset progress button next to the relevant workflow. Learn more about user workflow states.
Debug workflows
When debugging workflows there are multiple places to look for information:
- Workflow editor: Review the workflow in the editor to ensure the logic is correct.
- User log: View the user’s log to see the workflow execution steps.
- User workflow state: Check the user’s workflow state to see if they are in progress, completed, or haven’t started the workflow.
- Browser console: Check the browser console for any errors that may have occurred during workflow execution.
- Broser network tab: Check the network tab in the browser console to see if the SDK requests are successful.