Testing a workflow in Shopify Flow

You can test a workflow before you activate it. This lets you verify your workflow logic and confirm that your variables and parameters are correct before activating the workflow to operate on its own. A workflow test doesn't take actions such as sending notifications, updating orders or products, or making any changes to your live store data. You can test a workflow at any time in Shopify Flow.

Every test starts with trigger event data. There are 3 ways to get trigger event data in Shopify Flow, depending on whether you want to use real store data or simulated store data:

  • Recording events: This option activates a test mode that monitors for live events naturally occurring on your store that would cause the workflow to trigger. In this mode, you can also open a new browser tab to manually perform a live action that would generate a test event with real data, such as creating a real order yourself to test the Order created trigger.
  • Creating events: This option lets you manually create simulated events using real data from your store that would cause the workflow to trigger without actually making any changes to your store. For example, you can select an existing order from your admin and use it's real data as the test event for an Order created trigger, even though it's already been created.
  • Generating events: Similar to manually creating a test event, this option has Sidekick generate simulated test events for you. For example, Sidekick can generate 2 test events (a passing condition and a failing condition) to test an Order created workflow using existing order data in your store, and then you can use, edit, or remove those test events based on your testing preferences.

Considerations for testing a workflow in Shopify Flow

Before you test a workflow, review the following considerations:

  • Workflows in test mode use your real store data to return Liquid variables and determine workflow logic, but don't take actions or make modifications to your store. A test run stops at the first action that tries to make a change in the workflow logic to prevent unintended changes.
  • You can test a workflow at any stage when creating the workflow. A workflow doesn't need to be complete to test your current version, but all steps in the workflow must be valid. Incomplete or misconfigured steps can't be used in a test.
  • The workflow's Recent runs list doesn't include test workflow runs.
  • Actions in a workflow that connect to external services, such as Send HTTP request, display configuration previews during a test, but display a Can't simulate this action message as it's returned data value instead of actual data.

Use real recorded events to test a workflow in Shopify Flow

When recording events, your workflow uses real store data based on the trigger that you set to produce a list of test events. Depending on what the trigger event is, you might need to manually perform the action to generate a test event. For example, if you're testing the Collection created event, then you need to manually create a collection in the Shopify admin for the workflow to record the event for testing.

Steps:

  1. From your Shopify admin, go to Apps > Flow.

  2. In the Workflows section, click the workflow that you want to test.

  3. Click Edit to open the workflow editor.

  4. At the workflow's trigger, click Test your workflow.

  5. In the Test your workflow dialog, click + Add event > Record events to activate the workflow's test mode.

  6. Optional: If there are no available test events generating naturally, then open a new browser tab and manually create an event that causes the trigger to start the test workflow.

  7. In the test event dialog, all triggered test events display in the Recording events list. Select the test event that you want to run the test workflow for.

  8. The workflow highlights specific conditions and actions to visually display the logic path that the workflow uses, based on the trigger event that you select. You can do any of the following actions:

    • To preview the applicable output based on the data from the test event, click a condition or action step in the workflow, and then click the Preview tab. This can be a useful way to confirm that any variables display the correct data.
    • To select a different test event, select a new test event from the Recording events list.
    • To refresh the workflow's test results, click Redo Icon Restart test on the workflow trigger.
    • To save the test event, click Heart Icon and then Save. After saving the test event, you can modify the test data as required.
  9. Optional: Click Stop recording to exit listening mode. You can resume listening for live test events again by clicking Start recording.

Create simulated events to test a workflow in Shopify Flow

When creating simulated events, either manually or using Sidekick, you provide event data based on the trigger that you set to produce a list of test events. These simulated events use real store data, such as product and collection information in your store that actually exists, but makes no actual changes to your store. You can then have the workflow use that simulated event to run the test of the workflow.

The data that you select during event creation depends on the type of trigger that starts the workflow. For example, a workflow that begins with the Order created trigger requires you to select only an existing order to use as the test event. However, the Company contact assigned permission trigger requires you to select a company location, a contact for that company, and a permission level to create the test event.

If you don't want to select the data to create a test event yourself, then Sidekick can generate a set of test events for you.

Steps:

Create event data manually
  1. From your Shopify admin, go to Apps > Flow.

  2. In the Workflows section, click the workflow that you want to test.

  3. Click Edit to open the workflow editor.

  4. At the workflow's trigger, click Test your workflow.

  5. In the Test your workflow dialog, click + Add event > Create event.

  6. In the Create event dialog, add test event information:

    1. Select the store data that you want to use as your test event based on the required fields for the trigger.
    2. Optional: In the Event name field, give your test event a brief, descriptive name.
    3. Click Save.
  7. The workflow highlights specific conditions and actions to visually display the logic path that the workflow uses, based on your new test event. You can do any of the following actions:

    • To preview the applicable output based on the data from the test event, click a condition or action step in the workflow, and then click the Preview tab. This can be a useful way to confirm that any variables display the correct data.
    • To select a different test event, select a new test event from the Saved events or Event history list.
    • To refresh the workflow's test results, click Redo Icon Restart test on the workflow trigger.
Generate event data with Sidekick
  1. From your Shopify admin, go to Apps > Flow.

  2. In the Workflows section, click the workflow that you want to test.

  3. Click Edit to open the workflow editor.

  4. At the workflow's trigger, click Test your workflow.

  5. In the Test your workflow dialog, click Generate events.

  6. In the Saved event list, select either of the 2 new test events that you want to run the test workflow for.

  7. The workflow highlights specific conditions and actions to visually display the logic path that the workflow uses, based on the test event that you select. You can do any of the following actions:

    • To preview the applicable output based on the data from the test event, click a condition or action step in the workflow, and then click the Preview tab. This can be a useful way to confirm that any variables are displaying the correct data.
    • To select a different test event, select a new test event from the Saved events or Event history list.
    • To refresh the workflow's test results, click Redo Icon Restart test on the workflow trigger.

Edit saved test events in Shopify Flow

You can edit the content of saved test events for your workflow at any time. You can also remove any saved test events entirely.

Steps:

  1. From your Shopify admin, go to Apps > Flow.

  2. In the Workflows section, click the workflow that you want to test.

  3. Click Edit to open the workflow editor.

  4. At the workflow's trigger, click Test your workflow.

  5. In the Saved event list, hover your cursor over the test event that you want to edit, and then click > Edit.

  6. Update the content of the fields in the test event. You might need to click X to remove data before you can select new data.

  7. Click Save.

  8. Optional: To delete the saved test event, hover your cursor over the test event that you want to delete, and then click > Remove.

Reviewing your workflow test

When you test a workflow in Shopify Flow, review the following information to ensure your workflow behaves as expected based on the test trigger event:

  • Is the workflow's overall logic following as you expect? For example, if a test event's condition is true, then does the workflow follow the logic path for the condition being met?
  • Is the workflow using the correct variables in all conditions and actions? For example, you might have asked the workflow to check for the fulfillments_item.totalQuantity variable, which returns the sum of all line item quantities for a fulfillment, instead of the order.fulfillmentsCount.count variable, which returns the count of fulfillments on the order.
  • Is the workflow using the correct operators in all conditions and variables?
    • Confirm the AND/OR logic. For example, for a condition with multiple elements, is the condition checking for both elements to be true (A AND B), or just one (A OR B)?
    • Confirm the None of/At least one of/All of logic, when applicable.
    • Confirm the correctness of your variable's operators, such as Equal to, Not equal to, Does not exist, Exists, Greater than, Less than, and Is at least one of logic, when applicable.
  • Are the workflow's conditions and actions happening in the correct sequence? For example, your workflow might be set to check for multiple different conditions at the same time, instead of checking one condition before moving on to the next one based on the result.

If a test workflow behaves unexpectedly, then review information about troubleshooting errors in Shopify Flow workflows.