Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When it comes to external dependencies there are mostly two ways this is dealt with:

- Often there is a backend-like structure, and you got a dummy backend of sorts. Django's mail sending is a typical example of this: https://docs.djangoproject.com/en/1.10/topics/email/#in-memo...

- Another commonly seen way is that there is a backend of sorts passed around and can be injected with little hassle from the tests. Often you'll see what boils down to a Mock, just written by hand, because it tends to be little hassle, and often results in quite clear testing code.

Generating types on the fly using mocking and then doing somewhat awkward indirect assertions is by comparison a bit convoluted and less clear.



Ah, that's where I was confused. I would call both of those solutions mocks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: