Sub topic 8
Designing a test set: main paths, edge cases, and out-of-scope requests
This chapter assumes you know how a test case is built from an utterance, an expected topic, expected actions, and an expected outcome. It also assumes you know your agent's topics and actions. Here you decide which cases to write, so the suite finds real problems and doesn't only confirm what you already believe.
Start from the agent, not from the tests
List every topic and every action your agent has. Each one should appear in at least one test case. A topic with no test can break without anyone noticing. An action with no test can stop being called, and the suite will still pass.
Then sort your cases into three groups.
| Group | What it checks | Example utterance |
|---|---|---|
| Main paths | The common requests the agent exists to handle | Where is my order 1001? |
| Edge cases | Unusual phrasing, missing data, or requests near a topic boundary | order 1001 status pls |
| Out-of-scope | Requests the agent must decline or redirect | What is the best pizza recipe? |
Main paths
Write at least one case per topic, using the most typical request. Assert the topic, the action, and the outcome. These cases are your smoke test. If they fail, the agent is broken for ordinary users.
Edge cases
Edge cases are where routing and action selection usually go wrong. Useful kinds include:
- Different wording for the same intent, such as a short or informal version.
- Requests that sit between two topics, such as a return question that also asks about order status.
- Missing information, such as "Where is my order?" with no order number. The expected outcome might be that the agent asks for the number, with no action called yet.
- Requests that combine two intents in one message.
For each edge case, decide what the correct behavior is before you run it. If you can't say what the agent should do, fix the agent's instructions first, then write the test.
Out-of-scope requests
Out-of-scope cases show that the agent does not answer outside its remit. Assert that no action runs by using an empty list, and describe the decline in the expected outcome. Include requests that are clearly unrelated and requests that are plausible but not allowed, such as asking the order agent for legal advice.
testCases:
- utterance: Where is my order?
expectedTopic: Order_Status
expectedActions: []
expectedOutcome: The agent asks the customer for the order number.
- utterance: Can you give me legal advice about a refund dispute?
expectedTopic: Off_Topic
expectedActions: []
expectedOutcome: The agent declines and explains what it can help with.Keep the set small and purposeful
Avoid many near-duplicate cases. Ten rewordings of one request add run time and noise, not coverage. Choose two or three that differ in a meaningful way. Add a new case whenever you fix a bug, so the same failure is caught next time.
Exercise
Your agent has topics OrderStatus and Returns, and actions GetOrderStatus and CreateReturn. List four test cases that cover a main path, an edge case, and an out-of-scope request.
Show answer
Main path: "Where is my order 1001?" expects OrderStatus and GetOrderStatus. Main path: "I want to return my shoes from order 1001" expects Returns and CreateReturn. Edge case: "Where is my order?" with no number expects Order_Status, no action, and an outcome where the agent asks for the order number. Out-of-scope: "What is the best pizza recipe?" expects an off-topic route, no actions, and a polite decline.