Platform
Send messages
Testing workflows

Testing workflows

Learn more about how to test workflows you build in Knock.

Once you've built your workflow, you'll want to test it to make sure it works as expected. Knock provides a number of tools to help you test your workflows.

The workflow test runner

#

You can use the Knock workflow test runner to test an end-to-end workflow and verify that it works as expected.

To use the workflow test runner, navigate to the workflow you want to test and click "Run a test." You'll have options to select the workflow's recipient, actor, tenant, and input any data that you'd like to pass to the workflow.

Two things to know about workflow test configuration:

  • The data field is populated using the workflow's schema as defined in your templates. You can click "Reset" at any time to reset the data field to the latest and greatest schema for your workflow.
  • The recipient and actor fields can contain either a user or an object. Use the toggle above the field to switch between these options.

After clicking "Run test," you will see a confirmation and a link to see the log to review the output and what was sent. You can learn more about Knock logs and the debugger here.

Note that some workflow settings are not enforced during test runs. Trigger frequency (for example, "once per recipient") is bypassed — each time you run a test, the workflow will execute for the selected recipient regardless of your frequency setting. To validate trigger frequency as it behaves in production, use the trigger API.

You can also use the workflow test runner to run a test payload for a source event trigger. If your workflow is triggered by an event, you will automatically see a JSON payload of the last received event that you can use to run a test. You can edit this payload or click "Fetch the latest event" to get the most recent from your source.

Testing workflows using the Knock CLI

#

You can also generate workflow runs using the workflow run command from the Knock CLI. You can learn more in our CLI reference.

New chat