-
Notifications
You must be signed in to change notification settings - Fork 0
Test double β Spy
Devrath edited this page Oct 24, 2023
·
1 revision

-
Spyis like a partial mock meaning, a part of the object will be mocked but part of it will be real implementation.
-
Mockis actually trying to be an interface.- When you specify a
mockyou are just checking the return method of that mock. -
Mocksees just the method calls and not the structure inside it. - Thus
mockruns the method and ignores the body.
- When you specify a
-
Spyis trying to be the actual class.- By using a spy, the entire class is running, the body of the class is running, the entire structure is running.
-
Spysees not just the calls of method but also the body in it. - Thus
spyruns the method and the body.