|
|
|
|
|
by jeremyloy_wt
849 days ago
|
|
Counterpoint when using mocks - if Bs behavior changes, one may not remember to update A’s test which would be falsely passing. This problem is exacerbated if B is a popular object used by many components. IMO if you own A and B, never use mock. Possibly write a Fake B if B is non deterministic or slow. Then write a parity test for B and Fake B |
|
> This problem is exacerbated if B is a popular object used by many components.
This is a great addition to the caveats I mentioned.
> IMO if you own A and B, never use mock.
I'm going to take issue with your use of the word "never" here.
If you said something like, "If you own A and B, don't use mocks the vast majority of the time", I'd even agree--but there are important exceptions (and I'd argue that non-deterministic B is one such exception).
> Possibly write a Fake B if B is non deterministic or slow. Then write a parity test for B and Fake B
Would you mind explaining what you mean here?