In this video, we will be diving into the world of test doubles and exploring the differences between stubs, mocks, and spies. Test doubles are substitutes for objects in unit tests, and they are used to isolate the test from external dependencies and improve testing reliability. Stubs return predetermined responses to calls made during the test, while mocks return fake data and allow for the saving and assertion of interactions. Spies, on the other hand, wrap themselves around the real object and observe its behaviour. Understanding the nuances between these types of test doubles can help you improve the effectiveness of your unit tests.
- Source code can be found here: [ Ссылка ]
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Contents of the video
00:00 - Intro
02:28 - Stubs
09:40 - Mocks
14:37 - Spies
18:04 - Conclusion
Ещё видео!