filmov
tv
Mocks & Spies

Показать описание
Each week in my Tuesday Lunch & Learn livestream, we look at a useful technical skill, define a challenge related to that skill, and solve the challenge live. This week, it’s mocks and spies.
Mocks and spies make it possible to test code in isolation by taking the place of real dependencies. They were developed as a tool for testing how objects interact. Unfortunately, in common practice, mock-based tests have several problems. They tend to be hard to understand and make code harder to refactor.
Our challenge this week: test-drive a simple command-line application using mocks, then fix the common problems mock-based tests encounter. We need to test our code's interactions *without* making tests that are difficult to understand or modify.
Mocks and spies make it possible to test code in isolation by taking the place of real dependencies. They were developed as a tool for testing how objects interact. Unfortunately, in common practice, mock-based tests have several problems. They tend to be hard to understand and make code harder to refactor.
Our challenge this week: test-drive a simple command-line application using mocks, then fix the common problems mock-based tests encounter. We need to test our code's interactions *without* making tests that are difficult to understand or modify.