🧪Fake (Testing)
Also known as Fake, Fake Object, In-Memory Fake
A small copy of a real part. It works, but only in tests.
Think of it like
Think of it like a toy kitchen. You can really cook pretend food, but it is not a real stove.
Example
Jack's tests use a fake user store that keeps users in a list. 500 tests run in 2 seconds, with no database to start.
Why it matters
Fakes let lots of tests run fast. They still act like the real part, not just give one set answer.
Definition
Common mistake
Key takeaways
- 1Really works. In a simple way.
- 2Fast and cheap. Often kept in memory.
- 3Tests only. Never for real use.