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

If you're testing the interface, changing the implementation internals won't create any churn (as the mocks and tests don't change).

If you are changing the interface, though, that would mean a contract change. And if you're changing the contract, surely you wouldn't be able to even use the old tests?

This isn't really a go problem at all. Any contract change means changing tests.



Yes, agreed. What the parent is saying about

> only ever use an interface, never the real implementation + mockgen the mocks based on this interface + use the mocks to assert that a function is called, with exactly this parameters and in this exact order.

is not ideal, and that's what we don't do. We test the real implementation, then that becomes the contract. We assume the contract when we write the mocks.




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

Search: