Testing and debugging workflows


Testing is a powerful and essential component of any project.

The testing approach mentioned below doesn’t sandbox your data in any way. Any changes performed by the workflow are reflected to the system itself.

At the moment, our workflows don’t implement any sophisticated testing framework, therefore it must be done manually. You can expect a powerful and flexible testing facility in the near future.

Let us look at an example. We want to implement a workflow that calculates the cost of a newly created lead. The cost of the lead is sent as an email to the administrator.

manual test example base

To simplify testing, we can use the manual workflow trigger.

Note that when you run the workflow directly from the workflow editor, the initial scope is not defined. If your workflow relies on any data from the initial scope, it is necessary to fetch it manually.

Keeping the above note in mind, your workflow should look something like the following:

manual test example modified

To manually run the workflow, click on the settings icon cog of the manual trigger and navigate to the bottom of the step configurator.

manual test run

When you manually run the workflow, you see a green outline that indicates the path of the execution based on the provided input. If any of the steps fail to successfully execute, they will be marked with a red outline. If there is no error handling, the manual execution will also terminate.

An example of a successful test:

manual test run ok

An example of a failed test:

manual test run nok

In some cases, your workflows may implement steps that should only run in production, such as client charging, mass email notifications and similar. We can mock this path of execution by defining a testing flag at the beginning. Before you reach the "in production only" steps, you should use an exclusive gateway to do some special handling, such as logging a message or using a debug step debug.

manual test special

When you run the workflow after that step, you should see something like the below example:

manual test special ok


Knowing how to debug a specific tool or software can save you a lot of time if you encounter an issue.

The debugging step

The debugging step debug allows you to inspect the contents of the scope it resides in.

The debugging step uses the logger configured by the server and is not visible in the workflow editor itself.

A simple example:

debug example simple

Test result context

When you run a manual test for the workflow you might notice an icon in the bottom right corner of the step.

debug stepctx

When you hover over the icon you see the important information regarding the steps' execution.

If you hover over a successful step (step with a green outline), you see the duration of the execution. Knowing the duration of the execution can help you pinpoint any system bottlenecks.

debug stepctx ok

If you hover over a failed step (step with a red outline), you see the duration of the execution and the encountered error.

debug stepctx nok