Recall & Review
beginner
What is a Test Double in software testing?
A Test Double is a simplified object that stands in for a real object during testing to control behavior and isolate tests.
Click to reveal answer
beginner
What is the main purpose of a Dummy object?
A Dummy object is passed around but never actually used. It just fills parameter lists to satisfy method signatures.
Click to reveal answer
intermediate
How does a Stub differ from a Dummy in testing?
A Stub provides predefined responses to calls made during the test, allowing control over indirect inputs, unlike a Dummy which is unused.
Click to reveal answer
intermediate
What role does a Mock play in unit testing?
A Mock not only simulates behavior but also verifies that certain interactions (like method calls) happened as expected during the test.
Click to reveal answer
advanced
Why use different types of test doubles instead of just one?
Different test doubles serve different purposes: Dummies fill parameters, Stubs control indirect inputs, Mocks verify behavior, making tests clearer and more focused.
Click to reveal answer
Which test double is used only to fill parameter lists and is never actually used?
✗ Incorrect
A Dummy object is passed just to fill parameters and is not used in the test logic.
Which test double provides canned responses to method calls during testing?
✗ Incorrect
A Stub returns predefined data to control indirect inputs in tests.
Which test double verifies that certain methods were called during the test?
✗ Incorrect
Mocks are used to verify interactions, such as method calls, happened as expected.
Why might you choose a Stub over a Mock in a test?
✗ Incorrect
Stubs provide canned responses but do not verify interactions.
What is the main benefit of using different test doubles?
✗ Incorrect
Different test doubles help isolate tests and make their purpose clearer.
Explain the differences between Dummy, Stub, and Mock test doubles and when to use each.
Think about how each double helps control or verify behavior in tests.
You got /3 concepts.
Why is it important to choose the right type of test double in unit testing?
Consider how different doubles affect test focus and reliability.
You got /4 concepts.