Sub topic 7
Writing the expected outcome
This chapter covers the third assertion in a test case: the expected outcome. It assumes you know how a test case is built from an utterance, an expected topic, and expected actions. It also assumes you can read a basic YAML file.
What the expected outcome checks
The expected topic and expected actions check how the agent worked. The expected outcome checks what the agent said. It is a plain-language description of the response you want. The Testing Center compares the agent's actual reply to that description and judges whether the reply meets it.
The outcome is not an exact string match. The agent's wording changes from run to run, so you describe the result, not the sentence.
Describe behavior, not wording
A good outcome names what the customer should learn or what should happen. A weak outcome is vague, or it copies one possible phrasing.
| Weak outcome | Better outcome |
|---|---|
| The agent answers well. | The agent tells the customer the current status of the order. |
| "Your order 1001 has shipped." | The agent states the order status and does not ask for information the customer already gave. |
| The agent refuses. | The agent politely declines and explains what it can help with. |
The first weak example cannot fail in any useful way, because "well" has no definition. The second fails when the agent says "Order 1001 is on its way," even though that reply is correct.
Match the outcome to the other assertions
The three assertions must agree with each other. If you expect the Get_Order_Status action, the outcome should describe a reply that uses its result. If you expect no actions, the outcome should not promise data that only an action can supply.
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.In the second case, the outcome describes a refusal. An outcome such as "The agent gives a pizza recipe" would contradict the intent of the test, because the topic is Off_Topic.
Keep each outcome to one idea
An outcome that lists several requirements is hard to diagnose. If the test fails, you do not know which requirement the reply missed. Prefer one clear statement per case. Use two only when they are tightly linked, such as "declines and explains what it can help with."
Avoid details the agent cannot know. If the reply depends on live data, such as a real shipping date, do not assert the value. Assert that the agent reports a status, since the data in the org can change.
Common errors
- Writing the outcome as a quoted sentence, which fails on harmless rewording.
- Writing a vague outcome that any reply would satisfy.
- Contradicting the expected actions, for example asking for order data with an empty action list.
- Asserting org data that changes between runs.
How the outcome fits the process
Each check is reported separately, so a case can pass on topic and actions but fail on outcome. That tells you the routing was right and the wording or content was wrong.
Exercise
A test for "Where is my order 1001?" uses the expected outcome "Your order 1001 is out for delivery." It fails even though the agent replied "Order 1001 is on its way." Why, and how would you rewrite the outcome?
Show answer
The outcome copies one exact phrasing, and the data may also change between runs. The agent's reply is correct but worded differently. Rewrite it to describe the result, such as "The agent tells the customer the current status of the order."
Exercise
A case expects no actions and the outcome "The agent tells the customer the delivery date of order 1001." What is wrong?
Show answer
The outcome needs data that only an action such as GetOrderStatus could supply, so it contradicts the empty action list. Either add the action to the expected actions, or change the outcome to describe a decline or a request for more information.