> For the complete documentation index, see [llms.txt](https://docs.nected.ai/nected-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nected.ai/nected-docs/rules/concepts/test-and-publish-rules.md).

# Test & Publish Rules

Nected lets you test rules in a staging environment before deploying them to production. There are two ways to test a rule:

1. **Quick Test** — a one-off, ad-hoc test with custom inputs. Best for exploring behavior during development.
2. **Test Suite** — a saved collection of test cases you can run all at once. Best for regression testing before every publish.

Both methods are accessible from the **Test Run** button in the top-right of the rule editor.

***

### Method 1: Quick Test

Quick Test lets you fire a single set of inputs at your rule and immediately see the output. Nothing is saved — it's a scratchpad for fast iteration.

![](/files/CAFPYX9xS7kodfrR7VKb)

#### How to Run a Quick Test

1. Open a rule (Simple Rule or Decision Table) in the editor.
2. Click the **Test Run** **▼** dropdown arrow next to Test Run and select **Run Quick Test**.\
   ![](/files/RcGwMMsWXurMegCDQbVH)
3. The **Test Rule** panel opens on the right.
4. Enter values for each input parameter:
   * You can test with different values, `null` values (for nullable parameters), or omit optional parameters entirely.
5. Click **Test Now**.
6. The result appears as a JSON output below:
   * A **success** response means your rule matched and returned the expected output — it's ready to publish.
   * A **failure** response means a condition wasn't met or the rule errored — review your logic before publishing.

{% hint style="info" %}
If a rule has nullable input parameters, you can test with `null` values for those parameters. If a rule has optional input parameters, you can test with and without those parameters.
{% endhint %}

#### What the Output Shows

* **Matched rows** — which rows/conditions in the rule were satisfied
* **Output values** — the values returned for each result column (code, description, discount type, etc.)
* **Default output** — whether the rule fell through to the default output
* **Errors** — any evaluation errors, missing inputs, or type mismatches

{% hint style="info" %}
Quick Test always runs against the **Staging** environment, so there's no risk to Production.
{% endhint %}

### Method 2: Test Suite

Test Suite is a persistent library of test cases tied to your rule. You define inputs and expected outputs once, save them, and re-run them with a single click whenever the rule changes. This makes it the right tool for regression testing before every publish.

<figure><img src="/files/RrFaJ4lIVPKg4goI4VS5" alt=""><figcaption></figcaption></figure>

#### Accessing the Test Suite

1. Open any rule (Simple Rule or Decision Table) in the editor.
2. Click the **▼** dropdown arrow to the right of the **Test Run** button.\
   ![](/files/DZFvrwgqjXB3AN8gvlmW)
3. Select **Run Test Suite** from the dropdown.
4. The **Test Suite** panel opens on the right.

#### The Test Suite Panel

The panel has the following controls in its header:

| Control                   | Action                                     |
| ------------------------- | ------------------------------------------ |
| **Search on Name**        | Filter test cases by name                  |
| **Run All Tests**         | Execute all saved test cases at once       |
| **Save Test**             | Save any new or edited test cases          |
| **View Last Test Result** | Jump to the results of the most recent run |
| **Download**              | Export all test cases as a CSV file        |

When no test cases exist yet, you'll see an empty state with two options: **+ Add test case manually** and **Import Test Cases**.

#### Adding Test Cases

<figure><img src="/files/QQbkE9ElzPCj8M4v3FTr" alt=""><figcaption></figcaption></figure>

**Option A: Add Manually**

1. Click **+ Add test case manually** (or the button in the empty state).
2. A new row appears in the table with these columns:<br>

   **Input columns** — one per rule input attribute (e.g., `name`, `type`, `value`):

   * Fill in the values that will be sent to the rule when this test runs.

   **Name & Group**:

   * **Name** — a label for this test case (used for search and for merge-on-import)
   * **Group Name** — optional; group related tests together (e.g., `brand tests`, `edge cases`)

   **Output / expectation columns**:

   * **Matching Row** — which row(s) in the rule you expect to match (e.g., `Row 1`, `Row 5`). You can expect multiple rows for rules with "All Matches" policy.
   * **Default Output** — `true` if you expect the default output to be returned, `false` otherwise
   * **Output field columns** (e.g., `code`, `main`, `description`, `discount`) — the exact values you expect the rule to return. Leave blank if you don't want to assert on that field.

   <figure><img src="/files/I4DE7lh7Uw3cSjBUMYXt" alt=""><figcaption></figcaption></figure>
3. Click **Save Test** (top-right) to persist the test cases.
4. A green toast confirms: **"X test cases saved."**

**Option B: Import via CSV**

For bulk test case creation, import a CSV file.

<figure><img src="/files/WJoVCW2yC0Fv1RVhiDK6" alt=""><figcaption></figcaption></figure>

1. Click **Import Test Cases**.
2. The **Upload File** modal appears.
3. **Choose an Upload Policy:**

   | Policy                                     | What it does                                                                                 |
   | ------------------------------------------ | -------------------------------------------------------------------------------------------- |
   | **Merge rows (based on name)** *(default)* | Updates existing test cases with the same name; adds new ones for names that don't exist yet |
   | **Append rows**                            | Adds all rows from the CSV as new test cases, regardless of name duplicates                  |
   | **Replace all rows**                       | Deletes every existing test case and replaces with the CSV contents                          |
   | **Replace row, exclude manually created**  | Replaces test cases that were previously imported, but preserves any manually added ones     |
4. Click **Download Template** to get a pre-formatted CSV with the correct column headers for your rule.
5. Fill in the template according to the downloaded template:

   ```csv
   name, group, , <input_attr_1>, <input_attr_2>, ..., defaultOutputData, <output_key_1>, <output_key_2>, ..., <action_1>, <action_2>
   ```

   * `name` — the test case name (required; used for merge-by-name)
   * `group` — optional group name
   * Input attribute columns — one per rule input parameter
   * `defaultOutputData` — `true` or `false`
   * Output key columns — expected output values (leave blank to skip assertion)
   * Action columns — expected action outcomes (if the rule has actions)
6. Upload the filled CSV (`.csv`, max 2 MB).
7. The imported test cases appear in the panel.
8. Click **Save Test** to confirm.

<figure><img src="/files/5flpjYCEGxk4DsoSxt4L" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Use **Merge rows** when syncing test cases from a shared spreadsheet — it won't delete cases you've added manually or that aren't in the current CSV.
{% endhint %}

#### Running the Tests

**Run All Tests**

1. Click **Run All Tests** in the panel header.
2. Nected runs every saved test case against the rule in Staging.
3. The **Test Result** view opens automatically, showing:

   | Column           | Description                                                          |
   | ---------------- | -------------------------------------------------------------------- |
   | **Status**       | Icon indicating Pending, Passed ✅, or Failed ❌                       |
   | **Name**         | Test case name                                                       |
   | **Group Name**   | The group it belongs to                                              |
   | **Input**        | The inputs that were sent to the rule                                |
   | **Matching Row** | Which rows matched and whether default output was returned           |
   | **Output**       | Actual output values returned by the rule, compared against expected |
4. The summary bar at the top shows **Total / Passed / Failed** counts. Like this:

<figure><img src="/files/t3x2Howx4epVMrFjTGED" alt=""><figcaption></figcaption></figure>

**Run a Single Test**

* Click the **▶ play** icon on any individual test case row to run just that one test.

<figure><img src="/files/9xrmU4zlvv2lK1vOgDBi" alt=""><figcaption></figcaption></figure>

**Re-run After Changes**

* After editing the rule, open Test Suite again and click **Run All Tests** to verify nothing regressed.
* From the Test Result view, click **Retest All** to re-run without going back to the suite panel.

#### Managing Test Cases

* **Search** — use the search bar to find test cases by name
* **Delete** — use the row action menu (⋮) to delete individual test cases
* **Download** — export all test cases as CSV at any time (useful for sharing or version control)
* **View Last Test Result** — check the most recent run's output without triggering a new run

### Quick Test vs. Test Suite: When to Use Which

|                        | Quick Test                            | Test Suite                              |
| ---------------------- | ------------------------------------- | --------------------------------------- |
| **Best for**           | Exploring behavior during development | Regression testing before every publish |
| **Saved**              | No — one-off only                     | Yes — persists across sessions          |
| **Multiple inputs**    | One at a time                         | All at once                             |
| **Pass/fail tracking** | No                                    | Yes, with summary counts                |
| **Import/Export**      | No                                    | Yes (CSV)                               |
| **Groups & naming**    | No                                    | Yes                                     |

{% hint style="info" %}
Testing is mandatory before publishing. Use Quick Test while building, and Test Suite as your final check before every publish to make sure existing behavior hasn't changed.
{% endhint %}

### Significance of Testing

Testing in Staging before publishing prevents unexpected behavior in Production. With Quick Test, you can rapidly iterate on logic. With Test Suite, you build a permanent safety net that grows with your rule — catching regressions before they ever reach users.

### Final Step: Publish the Rule

Once you're confident in the rule's behavior — Quick Test passes for your current changes, and Test Suite shows all cases passing — publish it. Click the **Publish** button in the top-right header. This makes the rule live in Production.

For teams using an approval workflow, submit the rule for review first. See [Approval Flow](https://claude.ai/nected-docs/audit/approval-flow.md) for details.

For version history and rollbacks, see [Version Control & Rollback](https://claude.ai/nected-docs/audit/version-control-and-rollback.md).
