February 2022
Intermediate to advanced
274 pages
6h 28m
English
Mock objects are typically intended to be objects that are used in place of the real implementation. However, by default, they will accept any access. For example, if the real object allows .start(index), we want our mock objects to allow .start(index) as well. There’s a problem, however. Mock objects are too flexible by default. They will also accept star() happily, any misspelled methods, any additional parameters, really anything.
Now initially, we won’t do that; we’ll test with the real method names and proper parameters, hopefully. But then mock drift can happen. Mock drift occurs when the interface you are mocking changes, and your mock in your test code doesn’t.
This form of mock ...
Read now
Unlock full access