Sub topic 3
What the Testing Center does
This chapter assumes you know what an Agentforce agent, a topic, and an action are. It also assumes you have an org with Agentforce and the Testing Center enabled. You do not need to write tests yet.
The problem it solves
An agent answers in natural language, and its wording changes from run to run. A normal unit test compares an exact return value, so it cannot judge an agent reply. The Testing Center runs batches of realistic utterances against your agent and checks what the agent decided to do, not only what it said.
What it evaluates
For each test case, the Testing Center sends an utterance to the agent and records three things:
- Topic: which topic the agent chose to handle the request.
- Actions: which actions the agent invoked while handling it.
- Outcome: whether the final reply meets the described result.
You compare each of these with what you expected. Topic and action checks are about routing. The outcome check is about the quality of the reply.
| Check | Question it answers | Typical failure cause |
|---|---|---|
| Topic | Did the request reach the right topic? | Overlapping topic descriptions |
| Actions | Were the right actions called? | Weak action instructions or inputs |
| Outcome | Did the reply do what the customer needed? | Unclear instructions or wrong data |
How a run works
A test suite is a saved set of test cases for one agent. When you start a run, the Testing Center processes each case independently and stores a result for it. You can then open the run and see which cases passed and which failed.
A first look at a test case
You can define a suite in the UI or in a YAML spec file. The spec below shows the shape of one case. The topic and action names are examples and must match the developer names in your own agent.
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.The subjectName ties the suite to one agent. Each entry under testCases pairs an utterance with the expected topic, actions, and outcome.
What it does not do
- It does not replace review of the agent's instructions. It shows you the symptom, and you still have to find the cause.
- It does not guarantee identical wording between runs. Because replies vary, write outcomes as descriptions of a result, not as exact text.
- It tests one agent at a time. A suite belongs to the agent named in its
subjectName.
Exercise
A test case sends "Where is my order 1001?" and the agent replies correctly, but the case fails. Which two checks should you look at first, and why?
Show answer
Look at the topic and actions checks. A reply can read well while the agent routed to the wrong topic or skipped the expected action, for example by answering from general knowledge. Compare the recorded topic and actions with the expected ones to see which differs.
Exercise
Why is an exact-text comparison a poor way to check an agent's reply?
Show answer
The agent's wording varies between runs, so an exact match fails even when the reply is correct. The Testing Center instead checks the reply against a described expected outcome, such as "The agent tells the customer the current status of the order."