Sub topic 12
Reading test results
This chapter assumes you have already written a test suite with expected topics, actions, and outcomes, and started a run. It covers what the results show and how to read them.
What a result contains
A run produces one result for every test case. Each result compares what the agent did with what you expected, on three checks:
- Topic: the topic the agent chose compared with the expected topic.
- Actions: the actions the agent called compared with the expected actions.
- Outcome: the agent's response compared with your expected outcome description.
A case passes only when every check passes. The run summary shows how many cases passed and failed, but that count alone does not tell you what to fix. Open the individual cases.
A reading routine
- Check the summary for the pass and fail counts.
- Open the failed cases first.
- For each one, find which check failed: topic, actions, or outcome.
- Compare the expected value with the actual value on that check.
- Decide whether the agent or the test is wrong. The next chapter covers that decision.
Read the checks in this order because they depend on each other. Actions belong to topics, so a wrong topic usually makes the action check fail too. Fix the topic first, then rerun before you chase the action failure.
What each failure usually means
| Failed check | Typical meaning | First place to look |
|---|---|---|
| Topic | The agent routed the request to a different topic | Topic names, descriptions, and scope |
| Actions | An action was missing, extra, or the wrong one | Action descriptions and topic instructions |
| Outcome | The response did not match the expected result | The response text and your outcome wording |
Getting results from the CLI
You can fetch results for an earlier run by job ID. JSON output is easier to filter in scripts.
sf agent test results --job-id <JOB_ID> --result-format json --target-org my-orgUse --result-format human when you want to read the output yourself.
Common reading mistakes
- Looking only at the pass rate. A suite at 90% can still fail the one case that matters most.
- Fixing the action check before the topic check.
- Changing the agent after one failure without rerunning. Responses can vary between runs, so rerun to see whether the failure repeats.
Exercise
A test case fails on both the topic check and the actions check. Which do you investigate first, and why?
Show answer
The topic check. Actions belong to topics, so a wrong topic usually causes the action failure too. Fix the routing, rerun, and see whether the action check still fails.
Exercise
A case passes on topic and actions but fails on outcome. The agent's reply is correct but worded differently from your expectation. What do you change?
Show answer
Change the test. Rewrite the expected outcome to describe the result you require, not specific wording. Then rerun the case.