2 ms·
Mocking and coverage aren't that closely related, but I agree that mocking makes tests less realistic, and therefore less useful. Mocking can be helpful when t
by chriswarbo 5y ago
Mocking and coverage aren't that closely related, but I agree that mocking makes tests less realistic, and therefore less useful.
Mocking can be helpful when that downside is still better than the alternative, e.g. if 'real' calls have significant latency, or a significant monetary cost, etc. In those cases mocking lets us do a whole lot more testing for the same amount of time/money/etc., which can make up for the loss of realism.
Mocking can be especially useful when adding tests to a legacy system. Greenfield work should aim to minimise the amount of mocking required, ideally to zero.