News for hackers. Stuff that matters.
Re:Prefer Fakes over Mocks by silveroriole on Wednesday October 14, 2020 @05:32AM (#24774784)
Hmm, if I’m having to write tests for my tests, I feel something has gone wrong in my life ;)
Re:Prefer Fakes over Mocks by chriswarbo on Wednesday October 14, 2020 @09:31AM (#24776296)
A "fake" isn't a test; it's a real, working implementation of some interface. The only reason we don't use such implementations in production is for some non-functional reason (efficiency, resilience, etc.). For example, if we want a key/value store we might choose Redis for production, but a HashMap is a perfectly good fake (and you can bet that the language/library implementing HashMap has a ton of tests!)
Re:Prefer Fakes over Mocks by rocqua on Wednesday October 14, 2020 @05:59AM (#24774927)
If this leads to having to spend less time on writing tests in total, things have gone right.

These fakes are much less maintenance heavy. As changes to implementation details don't require changes to tests. Hence, whilst you need to write tests for your tests, you spend less time writing tests in total.

Re:Prefer Fakes over Mocks by srtjstjsj on Thursday October 15, 2020 @12:50AM (#24785055)
A fake is an implementation. The same tests you use on the real implementation also test the fake implementation.