> For the complete documentation index, see [llms.txt](https://docs.decisionrules.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decisionrules.io/doc/rules/common-rule-features/rule-testing/creating-and-running-tests.md).

# Creating & Running Tests

### A. Save from Test Bench

1. Open the Test Bench tab.
2. Enter input JSON and click Run.
3. Click Save as Test.
4. In the dialog, select a target Test Suite and enter a Test Name.
5. Click Save. *Note: If the input matches an existing test, the UI displays the match. If the output differs from the saved version, you can overwrite the expected output.*

### B. Create Manually

1. Open the Tests tab.
2. Click Create New Test.
3. Select a Test Suite and enter a Name.
4. Input the Input JSON and Expected Output JSON.
5. *(Optional)* Add JSON paths to Ignored output properties.
6. Click Save.

### Executing Tests (Running Tests)

#### Manual Execution

1. Select the checkboxes next to the desired Tests or Test Suites.
2. Click Run selected.
3. *(If no checkboxes are selected, click Run all to execute all tests for the rule).*

#### API Execution

Tests can be executed programmatically for automation (e.g., CI/CD pipelines) using the Rule Testing API. [Rule Testing API](/doc/api/rule-testing-api.md)

### Debugging Test Runs

The left panel displays all Test Runs for the current rule.

1. Click a Test Run to view its details.
2. Expand a Test Suite to see individual Tests.
3. Expand a Test to inspect the Input, Expected Output, and Received Output.
4. Differences between expected and received outputs are highlighted automatically.

***

This page provides a focused view of tests for an individual rule. To manage your tests from a global workspace view, navigate to the main Tests section.: [Tests](/doc/space/tests.md)&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.decisionrules.io/doc/rules/common-rule-features/rule-testing/creating-and-running-tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
