Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Test doubles: stubs, fakes, mocks and spies card 6 of 6

Ask what the double lets the test see

Stubs check your output for a scripted answer. Fakes check behaviour against a simplified stand-in. Mocks and spies check calls. Two things are never checked. Every answer the double scripts in place of the real dependency. Every call nobody asserts on. That gap is where a green suite hides wrong code.
Terms on this card
dependency
Something your code calls but doesn't own, such as a payment gateway, database, clock or another service.
green suite
A set of tests that all pass.
green
A test or check that passes.
suite
All the tests of a project, run together.
Learn this step by step on Bytewise
Lesson goal: Distinguish the four kinds of test double: stubs return canned answers, fakes are working lightweight implementations, mocks verify interactions and spies record calls. Say what each kind lets a test verify, and what it lets a test silently skip. · the whole lesson