[Tutor] OT: "Your tests are only as good as your mocks." Comments?
boB Stepp
robertvstepp at gmail.com
Sun Jul 25 13:14:21 EDT 2021
From
https://swizec.com/blog/what-i-learned-from-software-engineering-at-google/#stubs-and-mocks-make-bad-tests
The author of this article notes an example from his practice where his mock
database that he used in his tests passed his tests when the actual code in
production no longer had a database column that was in his mock database. As
I have begun to play around with databases recently and how to test code
relying on them, this really caught my attention.
The overall article itself is a recap of what he read in a book about how
Google does things ("Software Engineering at Google"). In this situation
Google advocates for using "fakes" in place of mocks, where these fakes are
simplified implementations of the real thing maintained by the same team to
ensure API parity. How would the development and maintaining of these fakes
be done so that the fakes don't drift from coding reality like the mocks
might? It is not clear to me exactly what is going on here. And a more
Python-specific question: Does the Python ecosystem provide tools for
creating and managing fakes?
--
Wishing you only the best,
boB Stepp
More information about the Tutor
mailing list