Software Testing & QA (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Test Doubles Taxonomy: Dummy, Stub, Spy, Mock, and Fake.
junior Levelsoftware-testingBasic
In Simple Words: According to Gerard Meszaros' taxonomy:
- Dummy: Objects passed around simply to satisfy function signatures (e.g. filling an unused required argument
nullor{}). - Stub: Returns hardcoded, predefined responses to calls made during the test. Contains no verification logic.
- Spy: Wraps a real object or function to record execution history (how many times it was called, with what arguments).
- Mock: Pre-programmed with expectations of calls it should receive. Fails the test if the expected calls do not occur.
- Fake: A working implementation with a simplified shortcut not suitable for production (e.g. an In-Memory SQLite database or an in-memory
Mapsimulating a Redis cache).