> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zapier.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing a Workflow

> Step testing allows for the validation of a configured step, by execiting the defined action.

After supplying the required inputs for a given action, it can be helpful to validate the configuration by testing the action, in a similar way the main editor at zapier.com requires step testing. While not required via this API, it can be helpful to test actions;

* When there are common configuration challenges specific to your use case.
* To reduce the chance of user error.

<Steps>
  <Step title="Supply all the necessary inputs for a given action">
    Following the steps to [Build a Zap](/powered-by-zapier/zap-creation/how-to-build-a-workflow), retrieve all necessary inputs and authentications.
  </Step>

  <Step title="Execute the test">
    Leveraging the [/test](/powered-by-zapier/api-reference/actions/step-test) endpoint, make a request supplying all of the necessary `inputs` along with an `authentication` - or `null` if none is required.

    For example for an authenticated action with id `core:wJ3PxHpNArZ8MqvloW3L1ZyMDQ4nJ`, we might make the following request:

    <CodeGroup>
      ```js Request theme={null}
      //POST /actions/core:wJ3PxHpNArZ8MqvloW3L1ZyMDQ4nJ/test
      "data": {
      	"authentication": "KrG4mmZs",
      	"inputs" : {
      		"channel": "G45J5309P",
      		"text": ":rotating_light: THIS IS A TEST :rotating_light:",
      		"as_bot": "yes",
      		"username": "Step Test",
      		"icon": ":robot:"
      	}
      }
      ```

      ```js Successful Test Response theme={null}
      {
      "links": {
      	"next": null,
      	"prev": null
      },
      "meta": {
      	"count": 1,
      	"limit": null,
      	"offset": null
      },
      //Note: the data returned along with it's schema is unique to the action being performed.
      "data": [
      	{
      		"channel": "G45J5309P",
      		"ts": "1704292753.233659",
      		"message": {
      			"type": "message",
      			"subtype": "bot_message",
      			"text": ":rotating_light: THIS IS A TEST :rotating_light:",
      			"ts": "1704292753.233659",
      			"username": "Step Test",
      			"icons": {
      				"emoji": ":robot:"
      			}
              }
              ...
          }
      ]
      }
      ```

      ```js Successful Test Response (no results) theme={null}
      // Note: Tests that are configured correctly but return 0 results are returned with a 200 OK status code.
      {
      "links": {
      	"next": null,
      	"prev": null
      },
      "meta": {
      	"count": 0,
      	"limit": null,
      	"offset": null
      },
      "data": []
      }
      ```

      ```js Failed Test Response theme={null}
      {
      "errors": [
      	{
      		"status": 400,
      		"code": "test_failed",
      		"title": "ActionTestError",
      		"detail": "Error during execution: Error from Slack: channel_not_found",
      		"source": null,
      		"meta": {
      			"source": "ZAPIER",
      			"full_details": {
      				"message": "Error during execution: Error from Slack: channel_not_found",
      				"code": "test_failed"
      			}
      		}
      	}
      ]
      }
      ```
    </CodeGroup>

    <Warning>
      Note that in the event of a successful test, the `data` object returned is directly from the 3rd party app, and therefore has no defined schema.
    </Warning>
  </Step>

  <Step title="Clean up any created resources as part of the test">
    If possible, clean up any created resources as part of a successful test. Remember the test executes the action, so these assets could cause confusion for users should they discover them after a successful test.
  </Step>
</Steps>
