Sub topic 9
Creating a Test Suite in the Testing Center
This chapter shows how to build a test suite in the Testing Center UI, from opening the tool to saving a suite that is ready to run. It assumes you know what Agentforce agents, topics, and actions are. It also assumes you can open Setup in an org where Agentforce and the Testing Center are enabled, and that you understand the four parts of a test case: utterance, expected topic, expected actions, and expected outcome.
What you create
A test suite is a saved set of test cases for one agent. In the org it is stored as a test definition. You create the suite once, then run it as often as you like. Each run produces its own results, so the suite itself stays unchanged between runs.
The UI is the fastest way to start. It lets you pick topic and action names from lists, so you are less likely to mistype a developer name. Later chapters cover the same suite as a YAML spec for version control and the command line.
Before you start
Check these items first. Most problems at creation time come from one of them.
- The agent exists in the org and has at least one saved version. You can only test an agent whose topics and actions you can name.
- You know the developer names of the topics and actions you want to assert. These are the API-style names (for example
Order_Status), not the labels shown in the builder. - You have a list of utterances written in advance. Use the test design from the previous chapter: main paths, edge cases, and out-of-scope requests.
- Your user has the permissions needed to use the Testing Center. If the tool is missing from Setup, ask an administrator to confirm that it is enabled and assigned to you.
Create the suite step by step
- Open Setup and search for "Testing Center", or open it from the Agentforce area in your org.
- Choose the option to create a new test.
- Select the agent to test. The suite is tied to this agent, so every case in it runs against that agent.
- Give the suite a name and a description. The name becomes the suite's API name, so pick something stable such as
Order_Support_Agent_Tests. - Add test cases. For each one, enter the utterance, choose the expected topic, choose the expected actions, and write the expected outcome.
- Save the suite.
Some orgs also let you generate candidate test cases automatically or upload a CSV file. Treat generated cases as a draft. Read each one and confirm that the expected topic, actions, and outcome match what you want the agent to do, not just what it happened to do.
Fill in each test case
Each case has four fields. The table shows what to enter and what to watch for.
| Field | What to enter | Common mistake |
|---|---|---|
| Utterance | A realistic message a customer would send, in their words | Writing a polished sentence no customer would type |
| Expected topic | The topic that should handle the request | Using the label instead of the developer name |
| Expected actions | The actions that should run, in the order they should run | Listing an action that the topic does not include |
| Expected outcome | A plain-language description of what the response should achieve | Quoting exact wording that the model will never repeat |
Utterances
Write one intent per utterance. A message such as "Where is my order, and can I return it?" tests two paths at once, so a failure is hard to interpret. Split it into two cases.
Vary the phrasing across cases. If three cases all say "Where is my order 1001?" you learn about one path three times. Use different wording, such as "Has order 1001 shipped yet?" and "Track my package 1001".
Expected topic
Choose the topic that you want to handle the request. For an out-of-scope request, the expected topic is the topic you built to catch such requests. If your agent has no such topic, decide what it should do and create one before you write the test, because the test cannot assert a behavior the agent does not have.
Expected actions
List the actions the agent should run. If the right behavior is to run no action, leave the list empty. This is how you assert that the agent does not look up data for an off-topic question. An empty list is a real assertion, not a missing value.
Expected outcome
Describe the result in terms of what the customer learns or what changes. "The agent tells the customer the current status of the order" works. "The agent says 'Your order is on its way'" is brittle, because the model words the reply differently on each run.
A complete example
This is how the first two cases of a suite look once you have entered them. The same content appears as a YAML spec, which shows the structure clearly.
name: Order_Support_Agent_Tests
description: Core routing and action checks for the order support agent
subjectType: AGENT
subjectName: Order_Support_Agent
testCases:
- utterance: Where is my order 1001?
expectedTopic: Order_Status
expectedActions:
- Get_Order_Status
expectedOutcome: The agent tells the customer the current status of the order.
- utterance: What is the best pizza recipe?
expectedTopic: Off_Topic
expectedActions: []
expectedOutcome: The agent politely declines and explains what it can help with.The topic and action names are examples. They must match the developer names in your own agent. If a name does not match, the case fails even when the agent behaves correctly.
How the pieces fit together
The diagram shows the order of work from design to a saved suite.
Starting size and growth
Start small. A first suite of eight to twelve cases is enough to check that the suite works and that your names are correct. A reasonable first split is:
- Three or four main-path cases, one for each topic you care about most.
- Two or three edge cases, such as a missing order number or a vague request.
- Two or three out-of-scope cases, such as a recipe question or a request for another customer's data.
Run this small suite before you write fifty more cases. If the names are wrong, you fix them once instead of fifty times.
Common errors at creation time
- The topic or action does not appear in the list. The agent version you selected may not include it, or the action may not be added to that topic. Open the agent in the builder and confirm that the topic and action exist and are saved.
- A case fails on the first run although the agent looks right. Compare the names character by character. A label such as "Order Status" does not match the developer name
Order_Status. - Every case expects an action. A suite with no empty action lists never checks that the agent stays quiet when it should. Include at least one out-of-scope case with no actions.
- Outcomes copy a sample reply. If you paste a model reply into the outcome field, the case tests that exact wording. Rewrite it as a description of what the reply must accomplish.
- One suite holds everything. A single huge suite is slow to run and hard to read. Split by agent area, for example one suite for order questions and one for returns.
Checking your work before the first run
Before you run the suite, read it once as a reviewer.
- Does every case have a different intent or phrasing?
- Does every expected topic and action use a developer name that exists?
- Is each expected outcome a description rather than a quoted reply?
- Is there at least one case with an empty action list?
- Do the utterances reference records, such as order 1001, that exist in the org where you will run the suite?
The last check matters because a test that asks about a record the org does not hold can fail for data reasons, not agent reasons. You will separate those two kinds of failure when you read results later in the tutorial.
Exercise
You add the utterance "What is the best pizza recipe?" to a suite for an order support agent. Which expected actions list is correct if the agent should decline, and why?
Show answer
An empty list (expectedActions: []). The agent should answer by declining and should not run any lookup or update action. The empty list asserts that no action runs, so the case fails if the agent calls an action such as GetOrderStatus for an off-topic request. The expected topic is the topic that handles out-of-scope requests, for example Off_Topic.
Exercise
A case expects the topic "Order Status" and passes none of its checks even though the agent answers a status question correctly. What is the most likely cause, and how do you fix it?
Show answer
The case uses the topic's label instead of its developer name. Replace it with the developer name, such as Order_Status, as it appears in the agent. Names must match exactly, including underscores and capitalization.