What are testing doubles?
Before we get into the specifics about stubbing/mocking, it would be helpful to go over some industry-standard terminology. First of all, there is the concept of testing doubles. Interestingly, the term comes from a movie-making technique that's related to how stunts are filmed. When performing dangerous acts, a stuntman or stuntwoman replaces the actor or actress to perform the job. From a viewer's perspective, it would look like the original actor or actress was performing. Testing doubles are the same in the sense that a fake component is used in place of the real thing during testing.
There are multiple types of testing doubles, but the most useful ones are stubs and mocks, which we will focus on in this section. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access