---
title: Test and debug
description: >-
  Test monitor triggers, individual workflow steps, and debug failed steps using
  run history and error messages.
breadcrumbs: Docs > Actions > Workflow Automation > Test and debug
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Test and debug

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Test a monitor trigger{% #test-a-monitor-trigger %}

You can test a monitor trigger during workflow creation. Testing a monitor generates a snippet that you can paste into your monitor notification window to trigger the workflow.

To test a monitor trigger:

1. Select the monitor trigger action in your workflow.
1. Click Test from Monitor.
1. If your monitor passes inputs to the workflow, enter a test value under Workflow Inputs.
1. Select a monitor to test.
1. Select a monitor state.
1. Click Run From Monitor.

## Test a step{% #test-a-step %}

To ensure a step functions as desired without having to run the entire workflow, you can test the step independently.

To test a workflow step:

1. Click Test in the step Inputs section.
1. Optionally, adjust the step configuration. If your step uses output variables from a previous step, enter some hardcoded test data for the step to use.
1. Click Test to test the action.
1. When you're finished testing the step, click Use in configuration to use your new configuration in the workflow, or close the screen to return to the workflow without saving your test configuration.

Testing is not available for branching and logic actions. To test a JavaScript function or expression action that uses output variables from a previous step, comment out the variables in your code and replace them with test data. For more information, see [Test expressions and functions](https://docs.datadoghq.com/actions/workflows/expressions.md).

## Debug a failed step{% #debug-a-failed-step %}

You can use a workflow's Run History to debug a failed step. Click Configuration or Run History in the top-left to switch between the configuration and run history views.

Clicking on a failed step gives you the inputs, outputs, and execution context for the step, as well as the associated error message. The example below shows a failed *GitHub pull request status* step. The error message shows that the step failed due to missing permissions:

{% image
   source="https://docs.dd-static.net/images/actions/workflows/test_and_debug/failed-step4.4346dbef64ba529999f0921da4ecc68d.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/actions/workflows/test_and_debug/failed-step4.4346dbef64ba529999f0921da4ecc68d.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A workflow with a failed step." /%}

The initial run history for a workflow provides a panel with the list of previous workflow executions and whether each execution succeeded or failed. Failures include a link to the failed workflow step. Click on a workflow execution in the list to inspect it. You can return to the initial execution history at any time by clicking anywhere on the workflow canvas.

## Fix a failed step with AI{% #fix-a-failed-step-with-ai %}

In Run History, select a failed step and open its Outputs tab. Next to the error message, click Fix with AI to get help resolving the failure.

{% image
   source="https://docs.dd-static.net/images/actions/workflows/test_and_debug/fix-with-ai.ce59cad3faca60958b59b70abb0f81ac.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/actions/workflows/test_and_debug/fix-with-ai.ce59cad3faca60958b59b70abb0f81ac.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Bits Chat diagnosing and proposing a fix for a failed workflow step." /%}

The assistant opens in [Bits Chat](https://docs.datadoghq.com/bits_ai/bits_chat.md), diagnoses the failure using the step's inputs, outputs, execution context, and error message, and can search external documentation for errors returned by third-party APIs. It explains the issue and proposes a fix, then asks you to confirm before applying any change. After you confirm, the assistant updates the step's configuration and reruns validation.

Fixes with AI apply to problems in the workflow's configuration, such as incorrect inputs or an outdated action setup. For failures caused by external factors, such as invalid credentials, rate limits, or an outage in a connected service, the assistant explains the root cause and suggests next steps, such as checking your credentials or contacting the owner of the connected service.

If the failed step triggers another workflow, Bits Chat can trace the failure into the triggered workflow to diagnose and propose a fix there as well.

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Getting Started with Workflow Automation](https://docs.datadoghq.com/getting_started/workflow_automation.md)
- [Build workflows](https://docs.datadoghq.com/actions/workflows/build.md)
- [Trigger workflows](https://docs.datadoghq.com/actions/workflows/trigger.md)

 Do you have questions or feedback? Join the **#workflows** channel on the [Datadog Community Slack](https://chat.datadoghq.com/).
