> ## Documentation Index
> Fetch the complete documentation index at: https://cobalt-55-abhishek.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow Testing

> Workflow Testing in Refold enables you to test your workflow's functionality by running it with sample payloads as you build it.

It allows you to:

* Execute multiple test cases for a workflow by modifying the input payload.

* Test and inspect the output values of each workflow node.

* Use the Run Node button at the bottom of each step to execute it for the authenticated Linked Account.

## Pre-requisites for Workflow Testing

Before testing a workflow, ensure the following steps are completed:

<Accordion title="Configure a Linked Account" defaultOpen="true">
  Click the `Configuration` button in the workflow editor and select a **[Linked Account](/legacy/concepts/linked_account)** under `Prerequisites` for the workflow.

  If the Linked Account is not authenticated with the integration or if its authentication has expired, a warning will appear.

  Click the **Authorize Application** button to reauthenticate or establish a connection with the integration.

  <img height="200" src="https://mintcdn.com/cobalt-55-abhishek/xvJAD8-ICYXgXerh/images/Guides/Workflow/testing_linked_account.png?fit=max&auto=format&n=xvJAD8-ICYXgXerh&q=85&s=ffd8ff37e3476ba0182339fb1aa7a35e" alt="Authenticating Linked Account for testing" data-path="images/Guides/Workflow/testing_linked_account.png" />

  Once authentication is complete, a **Connected**  status will be displayed.
</Accordion>

<Check>Click `Next` to proceed.</Check>

<Accordion title="Provide a Sample Payload" defaultOpen="true">
  Enter a payload with data to be used during workflow testing.
  A sample payload will automatically load based on the event trigger defined in the workflow.
  Modify the sample payload if necessary to suit your testing requirements.

  <img height="200" src="https://mintcdn.com/cobalt-55-abhishek/xvJAD8-ICYXgXerh/images/Guides/Workflow/testing_payload.png?fit=max&auto=format&n=xvJAD8-ICYXgXerh&q=85&s=26ea425a6f4833272b1df8096212480b" alt="Setting Payload for testing" data-path="images/Guides/Workflow/testing_payload.png" />
</Accordion>

After completing these steps, click the `Save Configuration` button.

<Check>Your workflow is now ready for testing.</Check>

## Steps to test

Refold provides options for testing both ndividual nodes or the entire workflow.

#### Testing Node

<Steps>
  <Step title="Select Node">
    Click on the node you want to test.
  </Step>

  <Step title="Run Node">
    At the bottom of the editor, click the `Run Node` button.
    <Warning>Testing for Group Node and Pagination is currently not supported.</Warning>
  </Step>

  <Step title="Check Input and Output">
    Expand the testing modal by clicking the `^` button at the bottom and view the input and output details of the test run under the `Node` tab.

    <img height="200" src="https://mintcdn.com/cobalt-55-abhishek/_hA6Vms9JiMZCzQC/images/Guides/Workflow/node_output.png?fit=max&auto=format&n=_hA6Vms9JiMZCzQC&q=85&s=3e408c961f216ae99a2d0218006644cb" alt="Checking Input and Output of Test execution" data-path="images/Guides/Workflow/node_output.png" />
  </Step>
</Steps>

<Check>Once the node executes successfully, a checkmark appears on the node, indicating it has been tested.</Check>

#### Testing Entire Workflow

Open the testing modal present at the bottom and switch from the `Node` tab to the `Workflow` tab.

Click on `Run Workflow` button to perform a test execution and a **Test Run** log is generated with output of each node.
<Warning>Since testing for Group nodes is not supported currently, you might not receive the logs of the group node.</Warning>

<img height="200" src="https://mintcdn.com/cobalt-55-abhishek/xvJAD8-ICYXgXerh/images/Guides/Workflow/workflow_output.png?fit=max&auto=format&n=xvJAD8-ICYXgXerh&q=85&s=6d7f704404a4a7545aac945123a12481" alt="Checking Output of Workflow Test run" data-path="images/Guides/Workflow/workflow_output.png" />

## Workflow Templating

In Refold workflows, you can use dynamic variables generated through **Run Node** test execution to seamlessly access data from previous nodes. This method allows you to incorporate tested node response data into subsequent nodes.

<Tip>
  To learn more about how to do Templating in Refold, refer to the docs [here](/legacy/concepts/workflow/templating).
</Tip>

Simply go to input field where you want to use variable within a node, select **Nodes** tab from the `Insert Variable` modal, choose the node whose response you want to access and select the field from that node response.

<img height="200" src="https://mintcdn.com/cobalt-55-abhishek/_hA6Vms9JiMZCzQC/images/Guides/Workflow/response_example.png?fit=max&auto=format&n=_hA6Vms9JiMZCzQC&q=85&s=27ab944069e613626bf3701086fb88d4" alt="Using Node response as variable" data-path="images/Guides/Workflow/response_example.png" />

In this example, we used the `id` received in the response when project was created and it's visible as `4.id` in the field which is of the format `<node_number>.<response_field>`.

This streamlined approach of Workflow Testing ensures that your workflows perform as expected before deploying them in production.
