Sub topic 12
Reading test results
This chapter covers how to read the results of a Testing Center run. It explains what each result field means and how to turn a failed row into a decision. It assumes you can write a test case (utterance, expected topic, expected actions, expected outcome) and start a run from the UI or with Salesforce CLI. It also assumes you know how topics and actions fit together in an agent.
What a run produces
A run sends each utterance in the suite to the agent and records what happened. The result has two levels:
- Run level: an overall status and a summary of how many test cases passed and failed.
- Case level: one entry per test case, with an assessment of each thing you asserted.
Always read the case level. A suite that shows "80% passed" tells you nothing until you know which cases failed and why.
Each case is checked on up to three separate dimensions, matching the three expectations you wrote:
| Dimension | What is compared | Kind of check |
|---|---|---|
| Topic | The topic the agent chose against `expectedTopic` | Exact match on the topic name |
| Actions | The actions the agent invoked against `expectedActions` | Comparison of action names |
| Outcome | The agent's reply against `expectedOutcome` | Judged on meaning, not exact wording |
Because the dimensions are separate, one case can pass on topic and fail on outcome. Each dimension points to a different part of the agent, so you have to read them one at a time.
Reading a single case row
Open a case in the results view. You will see your expected values next to the values the agent produced. Read the row in this order:
- The utterance. Confirm it is the input you meant to test. A typo in the test is a common cause of a failure that looks like an agent bug.
- Topic, expected against actual. If the topic is wrong, the later fields rarely matter. The agent was working in the wrong context from the first step.
- Actions, expected against actual. Check which actions ran, and compare names with what you listed. Compare the names against the developer names in your agent, not the display labels.
- The agent's actual response. Read the text the customer would have seen.
- The outcome verdict. Compare the response with your
expectedOutcomesentence and decide whether the verdict is fair.
Reading in this order follows the agent's own order of work. It picks a topic, then runs actions, then writes a reply. The first dimension that fails is usually the root cause. Later failures are often just consequences.
Interpreting the combinations
The pattern of passes and failures across the three dimensions narrows down the cause. The table below shows the common patterns.
| Topic | Actions | Outcome | Likely meaning |
|---|---|---|---|
| Pass | Pass | Pass | The case is healthy. |
| Fail | Fail | Fail | The agent routed to the wrong topic. Check topic descriptions and scope. |
| Pass | Fail | Fail | The right topic, but the action was not chosen or not available. Check the topic's action list and action descriptions. |
| Pass | Pass | Fail | The agent did the right work but worded the result differently. Check the instructions, or check whether your expected outcome is too strict. |
| Fail | Pass | Pass | Unusual. Check whether you named the topic correctly in the test. |
The last row is a sign that the test itself may be wrong. If an agent produced the right actions and a good reply, a topic mismatch is more likely a naming error in the spec than an agent fault.
For an out-of-scope case such as the pizza recipe example, the passing pattern is a decline: the expected topic matches, expectedActions is empty, and no action ran. If an action ran on a case that expects an empty list, that is a failure, even if the reply sounds reasonable.
Working with the outcome verdict
The topic and action checks are mechanical. The outcome check is different, because the agent's wording changes from run to run and the verdict is a judgment about meaning. Keep three points in mind:
- A failed outcome can be a correct failure, where the agent said something wrong or incomplete.
- A failed outcome can also be a wording problem in the test. "The agent tells the customer the order status" is checkable. "The agent responds well" is not.
- A passing outcome with a failing action is still a real defect. A fluent reply does not prove the work was done. The agent may have answered from general knowledge instead of calling the action.
When you doubt a verdict, read the actual response and judge it yourself against your sentence. If you and the verdict disagree, rewrite the expected outcome so that it states one observable fact.
Getting results from the CLI
The UI is good for browsing one case at a time. The CLI is better for sharing results and processing them in scripts. The first command runs the suite and prints a readable report. The second fetches an earlier run by its job ID.
sf agent test run --api-name Order_Support_Agent_Tests --wait 10 --result-format human --target-org my-org
sf agent test results --job-id <JOB_ID> --result-format json --target-org my-orgUse human when you are reading at the terminal. Use json when another tool will consume the output. The results command is useful when a run took longer than your --wait time. The command returns before the run finishes, and you can fetch the results later with the job ID. If you do not have the job ID, sf agent test list shows the test definitions in the org, which helps you confirm you are targeting the right suite.
A triage routine
Treat each failing case as a question with three possible answers: the agent is wrong, the test is wrong, or the result is just variation. This flow shows the decision.
Run the flow in this order:
- Check the test first. Is the utterance realistic, and do the expected names match your agent exactly?
- Find the earliest failing dimension and form one hypothesis about it.
- Change one thing in the agent, or in the test, but not both.
- Rerun and compare. Only a repeated result counts as evidence.
Changing only one thing per rerun matters. If you edit a topic description and an action description together and the case passes, you do not know which edit helped.
Common reading mistakes
- Reading only the pass rate. A suite can show a high pass rate while the one failing case covers your most important path. Weigh cases by how much they matter.
- Trusting one run. The agent's replies vary, so one failure may not repeat. Rerun a case before you change the agent.
- Comparing display labels with developer names. The topic and action names in the spec must match the developer names in the agent.
- Editing the expected value to match the output. If you change a test to make it pass, make sure the new expectation describes behavior you actually want.
- Ignoring passing cases with odd responses. Skim the actual replies of passing cases now and then. A pass on a loosely worded outcome can hide a poor answer.
Exercise
A case for "Where is my order 1001?" expects topic OrderStatus and action GetOrder_Status. The results show the topic matched, no action ran, and the outcome check failed. The agent's reply gave a plausible status. Which dimension do you investigate first, and what is the likely cause?
Show answer
Investigate the actions dimension first, since it is the earliest failing one. The topic matched, so routing is fine. The agent most likely answered without calling GetOrderStatus. Check that the action is attached to the Order_Status topic and that its description makes clear when to use it. The plausible reply does not make this a pass, because the agent did not retrieve the real order data. Rerun the case after the fix to confirm the action now runs.
Exercise
Two cases fail on outcome only. In one, the reply is wrong. In the other, the reply is correct but worded differently from your expected outcome sentence. How do you handle each?
Show answer
For the wrong reply, treat it as an agent defect. Review the topic instructions, fix them, and rerun. For the correct but differently worded reply, treat it as a test problem. Rewrite the expected outcome so it describes one observable fact, such as "The agent tells the customer the current status of the order", instead of specific wording. Then rerun to confirm the verdict matches your own reading.