Skip to main content
All CollectionsBuild AutomationsWorkflowsExecutions
Simulate Steps in Torq with Mock Outputs
Simulate Steps in Torq with Mock Outputs

Leverage mock outputs to test workflows and logic with predetermined responses, avoiding unnecessary API calls or production changes.

Updated over a week ago

Simulate API requests with mock outputs. Mock outputs gives you fake but realistic responses, making it much easier to see how changes you make will effect your workflow. Mock outputs are great for trying out new features or tweaking your current setup, ensuring everything runs smoothly before going live. They're a simple yet powerful tool to improve and test your workflows efficiently.

Explore the Versatility of Mock Outputs for Your Workflows

  • Simplify Workflow Testing: Easily run parts of your workflow to pinpoint how changes affect the bigger picture, without needing to go through every step. It’s a great way to make adjustments and see immediate results in a controlled environment.

  • Dive Deep into Specific Outputs: Manually set responses for certain steps. When you're dealing with tricky scenarios like errors or unusual cases, this can help ensure your workflow logic holds up under various conditions.

  • Streamline Adding New Sections: Grab a mock output from an earlier step to seamlessly blend the new section in. This approach is also perfect for focusing on just a piece of a more extensive process, making testing less of a headache.

  • Progress Without Full Integration: Mock outputs let you fill in the gaps, allowing you to test and refine steps even if you’re still setting up integrations.

Mock output configurations are disabled when the workflow is published and don't affect workflow executions in production.

How to Use Mock Output

  1. Initiate Mock Output Configuration:

    • Identify the step in your workflow you’d like to test with a mock output.

    • Navigate to the Mock Output tab.

      enable and configure a mock output
  2. Create Your Mock Output:

    • Enter your desired mock data in the Output field. Utilize the suggested step output example as a starting point, or modify a previous step's output from the Execution Log for a more tailored approach.

      copy the output of a previous execution
    • For modifications or reversions, the step’s three-dot menu offers an Output Example option for reference.

      copy output example
  3. Activate Mock Output:

    • Toggle the Enable mock output switch to Yes. This activation is visually indicated by a yellow frame around the step.

  4. Execute with Mock Output:

    • Choose Execute with mock output to simulate the step with your predefined mock data. This option allows for an in-depth testing experience without affecting live data - the mock data will be available in the context.

      mock output indications
  5. Test Your Workflow with Mock Outputs:

    • For a comprehensive testing experience, click the arrow beside Test Run and select Test run with mock output. This lets you see how the entire workflow functions with the mock data in place. Opting for a standard Test Run executes the workflow with live data.

      Test run with mock output

Troubleshooting and Tips

  • Valid JSON Format & Size: If you encounter errors with mock outputs not behaving as expected, double-check that your mock data is in a valid JSON format and under the size limit of 100KB.

  • Testing in Phases: For complex workflows, consider testing in sections to isolate and address any issues more effectively.

  • Reverting Changes: Utilize the Output Example feature to easily revert any changes to the mock output if you need to start fresh.

The step properties, input parameters, integration, and Execution Options (runners, ignore failure, discard data, and so on) are ignored when the step is executed with mock output.

  • Mock output configurations are saved when the workflow is published and are available to use in any future development of the workflow.

  • Mock output configurations will be exported and imported with the workflow.

Use Cases

These examples demonstrate how mock outputs can be useful for different purposes.

Output as Mock Ouptut

Copy the step output example and modify the values to create a mock output that has the expected response structure with your test data. In the example below, a mock output for the Okta List Users with Filters step is created by using the step output example and modifying it to include the data of the users you don't mind testing the flow on.

copy the output example and modify it

Mock Output to Avoid API Request

Use a mock output to get a preconfigured response for the step into the context for other steps to reference without executing the step in production. In the example below, a mock output is used for the Okta Suspend User step when running the workflow with real user data to avoid suspending anyone while being able to test the rest of the flow.

The example is a simplified version of the Suspend Contractor Accounts with no logins in 7 days template.

mock output for nested workflow

Mock Outputs for Nested Workflows

You can use the instructions above to enable and configure a mock output for a nested workflow. Verify the expected nested workflow output by checking its Exit operators.

mock output to simulate connection to a third party service

Go Templates in Mock Outputs

You can use Go templates to customize your mock outputs even further. In the example below, the value of a variable from the context determines which of two mock output versions will be used.

Use Go templates to customize mock outputs

Did this answer your question?