Test doubles
What is a test double?
What is a test double?
A test double is the umbrella term for a stand-in object that replaces a real dependency that's slow or unpredictable, such as the network, a database, or the clock. The dependency has to be abstracted behind a protocol and injected before you can swap the real implementation out.
TestingMultiple choiceIntro
"I want to replace the analytics event sender and check in the test which events the view…
#test-double #mock #stub #spy
TestingShort answerAdvanced
You want to test a network layer that uses URLSession directly, with no real server. Can…
#mock
TestingShort answerBasics
This screen leans heavily on an API response. How would you change the code so you can…
#stub
TestingShort answerIntro
A music app's playlist ViewModel takes a track list from a Repository and produces…
#fake