> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Write test cases

A test case is one simulated conversation: a **user scenario** the simulated user follows, and the **expected behaviors** the agent is graded against.

## Add a test case

#### Create the test

In the **Tests** tab, click **Add test** and give the test a name. If the agent has no tests yet, you can instead generate a starter set with AI and edit from there.

![The test editor dialog with fields for the name, the user scenario, and the expected behaviors.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sarvam-api-docs.docs.buildwithfern.com/4129e75a2acc02edc1f9d23b2cd5a451bf06c82bc8d97db14bebb89948c76d54/voice-agents/images/tests-add-case.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260917%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260917T064440Z&X-Amz-Expires=604800&X-Amz-Signature=3c47d3e5318779ae77859444eafe6ec1e204bb9868b28dade4645419ed08119a&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

#### Write the user scenario

The user scenario is a brief for the simulated user on how to behave. The simulator improvises within it, so describe the person and their goal rather than the exact words:

> The caller has an appointment tomorrow but wants a weekend slot. They are in a hurry, switch to Hindi midway, and ask twice whether a cancellation fee applies.

Keep one intent per scenario — if a scenario covers several tasks, split it into separate test cases.

#### Add expected behaviors

Each behavior describes one thing to check for in the finished conversation. Write them as clear yes-or-no checks:

|   |                                                                             |
| - | --------------------------------------------------------------------------- |
| ✅ | "Repeats the final date and time back to the caller before ending the call" |
| ❌ | "Handles the call well" — nothing concrete to check                         |

## Next

#### [Run tests & review results](/conversations/build/tests/run-tests)

Run the tests and read transcripts and verdicts.

#### [Best practices (API)](/conversations/api/tests/best-practices)

How to write each part of a suite, in depth.