Tray Platform / Standard/Best Practices / Testing your workflows

Testing your workflows

Overview

When building workflows, you will invariably need to:

  • Run realistic test data through the workflow in order to check that your workflow is running as intended

  • Test individual sections of your workflow

  • Test any workflows that are called by your main workflow

Creating test data

With a script connector step

With an Object Helpers step

Testing strategies

Adding a Terminate step

When building your workflow section-by-section, you will very often need to test it up to a certain point.

In the below example we are wanting to check that the first few Jira steps are working, but we know that the rest of the workflow is not yet configured correctly, so we temporarily add a terminate step after the last Jira step:

terminate-example

Testing with branches

When you are wanting to test how your workflow responds to different payloads and values coming into your workflow, an effective strategy is to use the branch connector to create different testing paths within your workflow.

Automated workflow testing

Before deploying workflows, it is important to test them to make sure any errors are removed before affecting live systems.

We can break this process down into the following main steps, assuming your workflow uses a webhook or service trigger.

  1. Replace the trigger in the workflow of interest with a Callable trigger, and place the service trigger in a new workflow. This means that your main workflow will be able to receive data from both the service trigger, and your scheduled test

  2. Determine a test payload that can be used to trigger the workflow.

  3. Create another workflow that uses the Scheduled trigger, and uses the test payload determined in step 2 to trigger the main workflow.

  4. (Optional) Add some error handling logic to your main workflow

  5. (Optional) Configure the main workflow so as to undo any effects from testing

In the following example, we will be using a workflow that is triggered by a contact creation event in Salesforce. Please see our Salesforce Trigger documentation for instructions on how the trigger works.

Imagine the following 'Salesforce Trigger Example' workflow, which has a Salesforce trigger and performs a synchronisation to another system, in this case Netsuite:

testing-workflow-1

For the purposes of this guide don't worry about the details of the Transformation logic step here. It is there as a placeholder for any data processing that might need carried out before e.g. a new contact is pushed to Netsuite. In the case of Salesforce you would have to use a 'Find Record' operation which uses the id obtained from the trigger to pull the account which matches the id supplied by the trigger payload.