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

# Testing Automations

> How to test and debug your automations before deployment

# Testing Automations

Testing is a critical part of building reliable automations. Agent Studio provides tools to test individual nodes and complete flows before activating them.

## Node-Level Testing

Every node in Agent Studio can be tested individually using the **Play** button.

### How to Test a Node

1. **Select the node** by clicking on it
2. **Click the Play button** (▶) that appears on the node
3. **Provide test input** in the dialog that opens
4. **Review the output** to verify the node works as expected

### Test Input Options

When testing a node, you can provide input in several ways:

| Option                 | Description                                       |
| ---------------------- | ------------------------------------------------- |
| **Manual Input**       | Type in JSON data directly                        |
| **Select Entity**      | Choose an existing account, task, or other entity |
| **Use Sample Data**    | Use predefined sample data for testing            |
| **From Previous Node** | Use output from a previously tested upstream node |

### Example: Testing a Condition Node

1. Click on the Condition node
2. Click Play (▶)
3. Enter test input:

```json theme={null}
{
  "account_data": {
    "name": "Acme Corp",
    "health_score": 45,
    "arr": 150000
  }
}
```

4. Click **Run**
5. Review which output (True/False) received the data

### Inspecting Output

After running a test:

* **Output Data**: See the exact data the node produces
* **Execution Path**: For logic nodes, see which path was taken
* **Errors**: View any error messages if the test failed
* **Logs**: See detailed execution logs

***

## Testing Trigger Nodes

Trigger nodes require special consideration since they normally wait for events.

### Testing a Trigger

1. Click on the trigger node
2. Click Play (▶)
3. **Select a test entity** (e.g., choose an account for Account Segment trigger)
4. The trigger will execute as if that entity triggered it

### What Trigger Tests Verify

* Entity data is loaded correctly
* Flow context is established
* Output data structure is correct
* Connected downstream nodes receive data

<Note>
  Testing a trigger does **not** verify that the trigger conditions (segment criteria) are correct—it only tests the data loading and output. Verify your segment criteria separately.
</Note>

***

## Testing Complete Flows

Beyond individual nodes, you can test the entire flow end-to-end.

### Run a Test Flow

1. **Save** your automation
2. Click **Test Flow** in the toolbar
3. **Select test data** for the trigger
4. Click **Run Test**
5. **Watch execution** as it progresses through nodes
6. **Review results** for each node

### Test Flow Visualization

During a test run, you'll see:

* **Highlighted paths**: Active execution path lights up
* **Node status indicators**:
  * ✓ Green: Executed successfully
  * ✗ Red: Failed with error
  * ○ Gray: Not executed (skipped path)
* **Data flow**: View data at each connection point

### Reviewing Test Results

After a test completes:

| View                  | What It Shows                       |
| --------------------- | ----------------------------------- |
| **Execution Summary** | Overall success/failure, time taken |
| **Node Details**      | Input/output for each executed node |
| **Path Taken**        | Which branches were followed        |
| **Errors**            | Detailed error information          |

***

## Testing Best Practices

### Test Early, Test Often

<Accordion title="Test as you build">
  Don't wait until the flow is complete. Test each node as you add it to catch issues early.
</Accordion>

<Accordion title="Test with realistic data">
  Use actual entities from your Statisfy data when possible. This catches issues that sample data might miss.
</Accordion>

<Accordion title="Test edge cases">
  Include tests for:

  * Empty or null values
  * Maximum/minimum values
  * Unusual characters in strings
  * Missing optional fields
</Accordion>

### Test All Paths

<Accordion title="Test both True and False paths">
  For every condition node, run tests that exercise both outputs.
</Accordion>

<Accordion title="Test boundary conditions">
  If checking `health_score > 50`, test with scores of 49, 50, and 51.
</Accordion>

### Document Your Tests

<Accordion title="Save test cases">
  Keep notes on what test inputs you used and what results you expected.
</Accordion>

<Accordion title="Create test entities">
  Consider creating dedicated test accounts/contacts that you can use repeatedly without affecting production data.
</Accordion>

***

## Debugging Failed Tests

### Common Issues and Solutions

<Accordion title="Node shows 'No input data'">
  **Cause**: The node isn't receiving data from upstream.

  **Solutions**:

  * Check that connections are properly made
  * Verify the upstream node produces output
  * Ensure the connection types are compatible
</Accordion>

<Accordion title="@ reference returns empty/null">
  **Cause**: The referenced field doesn't exist in the data.

  **Solutions**:

  * Inspect the actual input data using node testing
  * Check for typos in field names
  * Verify the data structure matches your expectations
  * Check if the field is nested differently than expected
</Accordion>

<Accordion title="Condition always goes one way">
  **Cause**: Data type mismatch or incorrect operator.

  **Solutions**:

  * Inspect the actual values being compared
  * Check if comparing string "100" to number 100
  * Verify the operator matches your intent
  * Check case sensitivity for string comparisons
</Accordion>

<Accordion title="Action node fails">
  **Cause**: Invalid configuration or external service issue.

  **Solutions**:

  * Check all required fields are populated
  * Verify @ references resolve to valid values
  * Check integration credentials and permissions
  * Look for rate limits or service outages
</Accordion>

### Using Logs for Debugging

1. **Enable verbose logging** in flow settings (if available)
2. **Check execution logs** after test runs
3. **Look for error messages** with specific details
4. **Trace data flow** through each node

***

## Pre-Deployment Checklist

Before activating your automation, verify:

<Accordion title="All nodes tested individually">
  * [ ] Each node has been tested with realistic data
  * [ ] All outputs produce expected results
</Accordion>

<Accordion title="Complete flow tested">
  * [ ] Full flow executed successfully end-to-end
  * [ ] All conditional paths have been exercised
  * [ ] Edge cases handled correctly
</Accordion>

<Accordion title="Actions verified">
  * [ ] Email/Slack messages contain correct content
  * [ ] Tasks created with right assignments
  * [ ] Field updates work as expected
</Accordion>

<Accordion title="Error handling reviewed">
  * [ ] Flow handles missing data gracefully
  * [ ] No unintended side effects on failure
  * [ ] Errors are logged appropriately
</Accordion>

<Accordion title="Performance considered">
  * [ ] No infinite loops possible
  * [ ] SQL queries are efficient
  * [ ] External API calls are reasonable
</Accordion>

***

## Monitoring After Deployment

After activating your automation:

### Track Execution

* **Run History**: View all executions with status
* **Success Rate**: Monitor how often the flow completes successfully
* **Error Trends**: Watch for increasing failure rates

### Agent Studio Analytics

Switch to the **Executions** view in Agent Studio for a workspace-wide analytics table:

* Filter by date range (last 24 hours, 7 days, 30 days, or a custom range)
* Filter by flow, trigger entity, or status
* Drill into an individual run to see the trigger payload, the node-by-node execution path, the last component reached, and any error details
* Sort by execution time to find your slowest flows
* Aggregated counters (**Total Executions**, **Unique Flows**, **Completed**, **Failed**, **Pending**, **Approval Pending**, **Paused**) refresh as you change filters

The Executions view is the fastest way to triage failures across many flows at once — start there when something looks off, then jump back into the canvas to fix the specific node.

### Execution Statuses

Each execution in the run history is labeled with one of these statuses:

| Status               | Meaning                                                                                                                                                                                      |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Pending**          | The execution has been queued but hasn't started yet.                                                                                                                                        |
| **Paused**           | The flow hit a **Sleep V2** component (or other pause point) and is waiting for the timer to elapse before resuming. Paused executions don't count toward failures and resume automatically. |
| **Approval Pending** | The flow reached a **Human-in-the-Loop V2** component and is waiting for an approver to act in the Approvals queue.                                                                          |
| **Completed**        | The flow ran end-to-end without errors.                                                                                                                                                      |
| **Failed**           | The flow stopped because a component raised an unhandled error. Check the node logs to diagnose.                                                                                             |

<Tip>
  Filter run history by status to triage quickly — start with **Failed** to find regressions, then check **Approval Pending** for stuck approvals before reviewing **Paused** flows that are simply waiting on a sleep timer.
</Tip>

<Note>
  **Paused** and **Approval Pending** are not error states. The flow is intentionally waiting and will move forward on its own once the condition clears (timer elapses or an approval is taken).
</Note>

### Set Up Alerts

Consider adding monitoring within your flow:

```
Main Flow → Catch Errors → Slack Alert to #dev-alerts
```

### Review Periodically

* Check that the automation is still relevant
* Verify integrations haven't changed
* Update conditions if business logic changes

## Next Steps

<CardGroup cols={2}>
  <Card title="AI Components" icon="robot" href="/agent-studio/automations/ai-components">
    Add AI-powered nodes to your flows
  </Card>

  <Card title="Agents Overview" icon="brain" href="/agent-studio/agents/overview">
    Build intelligent AI agents
  </Card>
</CardGroup>
