ELI5: Explain Like I'm 5

Test double

Okay kiddo, have you ever heard of pretend play? Test double is kind of like that!

Imagine you’re playing superheroes with your friends. Sometimes you might want to pretend to be your friend’s sidekick, and other times you might want to pretend to be a villain so your friend can practice being a hero. That’s what test doubles do for programmers!

Test doubles help programmers test their code by pretending to be other parts of the code. There are different types of test doubles, like dummy objects (that just exist to take up space), fake objects (that are programmed to act like real objects but don’t actually have all the same features), and mock objects (that are programmed to pretend to be a real object and give certain types of responses).

So, just like how you might pretend to be different characters in a game of pretend play, test doubles help programmers test their code by pretending to be different parts of the program!