# Testing your pathway

> Simulated callers, pass/fail checks, and the gate that stops a broken pathway from going live.

Source: https://docs.cleartalk.ai/docs/pathways/testing

You can have a conversation with your pathway before any real customer does. A **test** is a simulated caller with a personality and a goal, who talks to it while a set of **checks** decide whether it did the right thing.

No real call is placed and no real customer is involved. Tests run against your staging version, so you can break things safely.

Agents that run on a prompt rather than a pathway can be tested too — see [testing your agent](/docs/agents/testing) for what differs.

<Summary
  items={[
  "A test is a caller profile plus a set of pass/fail checks.",
  "Start from the template gallery, or turn a real call that went badly into a test.",
  "A run shows the transcript, each check, and how naturally the conversation flowed.",
  "Mark two or three tests “Required to publish” — not a dozen.",
]}
/>

<Callout title="Where tests live">
  You write and run tests in the **Tests** panel inside the Pathway builder. The **Testing** page in the sidebar is every test in your organization in one searchable table — filter by agent, category or last result, open a test to edit it in a side panel, or tick several to **Run**, **Delete** or **Leave out of Run all** together. Availability depends on your plan, and runs consume credits like any other conversation.
</Callout>

<Screenshot
  src="/img/pathway-tests-panel.png"
  alt="The Tests panel open beside the pathway canvas, listing one test with its category, run status, check count, and toggles for including it in Run all and requiring it to publish."
  caption="The Tests panel. Each row is one simulated caller and the checks that decide whether it passed."
  pins={[
  { x: 97, y: 24.1, from: "right", at: 102, label: "Runs every enabled test. Each run costs credits, like a real conversation." },
  { x: 97, y: 31, from: "right", at: 102, label: "The test, its category, when it last ran, and how many checks it carries." },
  { x: 97, y: 40, from: "right", at: 102, label: "Turn this on and a failing test warns you before the pathway can go live." },
]}
/>

## Talking to it yourself first

Before you write a single test, use **Test chat** — the panel next to Tests in the toolbar. You type, the pathway answers, and the step it's currently on lights up on the canvas as the conversation moves.

<Screenshot src="/img/pathway-test-chat.png" alt="The Test chat panel open beside the pathway canvas, with an empty conversation and a message box at the bottom." caption="Test chat: type at your pathway and watch which step answers." pins={[{ x: 96.9, y: 88.5, from: "right", at: 102, label: "Type as a caller would. No phone call is placed and no customer is involved." }]} redactions={[{ x: 3.4, y: 93.6, w: 11.6, h: 5.2, reason: "Account name and email hidden" }]} />

This is the fastest way to catch a step that never gets reached or a branch that fires on the wrong answer. Tests are for locking that behaviour down once you're happy with it.

### Which version Test chat talks to

Test chat runs the version on screen. In the Staging view that's your last **Save** — unsaved changes on the canvas aren't in it, so save before you chat. Switch to Production, or open an older version from **Versions**, and the chat runs that one instead. Whenever the version changes, including after a save, the chat starts a fresh conversation.

## Writing a test

Three parts:

**The caller profile** — who is calling and how they behave. This is where the value is, so be specific. "A caller who wants a Saturday appointment, is in a hurry, and gets impatient if asked more than one question at a time" exercises your pathway far harder than "a customer".

**The caller name** — what the simulated caller is called, so transcripts read naturally.

**The checks** — what has to be true for this to count as a pass. Each check is one condition, and the run reports them individually ("3 of 4 checks passed"), so keep them single-purpose:

* The agent offered at least two appointment times
* The agent never quoted a price
* The agent asked for a callback number before ending
* The call ended with a booking

Write checks about *outcomes and obligations*, not exact wording:

<DoDont
  goodTitle="Checks that survive an edit"
  badTitle="Checks that break on a rewrite"
  good={[
  "“The agent confirmed the caller's address”",
  "“The agent offered at least two appointment times”",
  "“The agent never quoted a price”",
]}
  bad={[
  "“The agent said: Can I confirm your address?”",
  "“The agent said Tuesday at 2pm and Wednesday at 10am”",
  "“The agent used the word complimentary”",
]}
/>

If your agent speaks more than one language, write checks that hold in all of them. "The agent said: Can I call you back?" fails a correct reply in Spanish; "The agent offered a callback, in whichever language the caller used" passes it. Give each language its own test, with the caller profile written in that language, and add a check like "The agent replied in Spanish once the caller switched" where switching matters.

When a test fails, read the transcript before changing the agent. If the agent did the right thing and the check marked it wrong, fix the check.

## Start from a template, or a real call

Two shortcuts worth knowing:

**The template gallery** covers the situations everyone needs and nobody thinks of first — happy path, edge cases, voicemail, voicemail screening, call screening, frustrated callers, hostile callers, confused callers. Clone the ones that apply to you and edit the details.

<Key>
  **Create a test from a real call.** In Conversations, open a call that went badly and turn it into a test. Every real failure becomes a permanent check that the same thing can't come back — fix the pathway, and the test proves it stays fixed. This is the highest-value habit in the whole feature.
</Key>

## Reading a run

Run one test, or run them all. A run gives you:

* **The transcript** of the simulated conversation.
* **Each check**, passed or failed, individually.
* **A natural conversation score** — how well the conversation actually flowed, rated on things like pacing, empathy, and conciseness. A run can pass every check and still score poorly, which usually means the pathway is correct but stilted. That's worth knowing before customers tell you.
* **Analyze failure** on a failed run — an AI post-mortem giving a **root cause** and **suggested fixes**, so you're not re-reading a transcript hunting for the moment it went wrong.

## The publish gate

Mark a test **Required to publish** and it becomes a gate: if it's failing, you're warned before the pathway can go live. Reserve this for the things that must never break — the booking actually completes, the disclosure is always given, the agent never promises a price it can't honour. A dozen required tests that fail for cosmetic reasons will train everyone to click past the warning, which defeats the point.

## A practical routine

1. Before a pathway's first publish, write tests for the **main path** and **each branch**.
2. Add the templates that match your reality — voicemail if you dial out, frustrated callers if you handle complaints.
3. Mark the two or three genuinely critical ones **Required to publish**.
4. Every time a real call goes wrong, **make a test from it**.
5. Run everything before each publish, and read the conversation score, not just the pass count.

Pathways that get tested get changed with confidence. Ones that don't get changed nervously, or not at all.
