Mocks and Real-Model Tests
In this article
- Place a check of an agent on a fake model, a fake tool, a real tool in a sandbox or repeated runs of the real model.
- Write a test that makes a fake tool fail on purpose and checks how the agent code reacts.
- Say what each kind of test cannot prove.
- Spot a mock that has gone stale after the real tool changed, and add the check that catches it.
- Terms defined here: test double, fault injection.
Overview
A made-up online shop's support agent issues refunds through a create_refund tool; order O-1042 was paid 49.00 EUR. The team's first test suite for the agent is fast, free and green. But half of the agent is ordinary code, and the other half is a model whose choices change from run to run. What does green prove?
You will learn to place each check where it can prove something: on a fake model, a fake tool, the real tool in a sandbox (a test copy with no real money), or many runs of the real model. You will also see a suite stay green while production breaks, and the check that catches it.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Fake model, fake tool
- Failures on demand
- The sandbox: assert on what changed
- Repeated runs for decisions
- What each layer cannot prove
- The stale mock
- Test layout
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions