(no title)
SPascareli13 | 2 months ago
I find this types of tests incredibly coupled with the implementation, since any chance require you to chance your interfaces + mocks + tests, also very brittle and many times it ends up not even testing the thing that actually matters.
I try to make integration test whenever possible now, even if they are costly I find that the flexibility of being able to change my implementation and not break a thousand tests for no reason much better to work with.
Phlebsy|2 months ago
The fundamental point of tests should be to check that your assumptions about a system's behavior hold true over time. If your tests break that is a good thing. Your tests breaking should mean that your users will have a degraded experience at best if you try to deploy your changes. If your tests break for any other reason then what the hell are they even doing?
aranw|2 months ago
Same I have zero confidence in these tests and the article even states that the tests will fail if a contract for a external service/system changes
rhines|2 months ago
These tests won't detect if a dependency has changed, but that's not what they're meant for. You want infrastructure to monitor that as well.
tonyhb|2 months ago
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.
preetamjinka|2 months ago
> 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.
unknown|2 months ago
[deleted]
esafak|2 months ago
et1337|2 months ago
The pain comes when system B changes. Oftentimes you can’t even make a benign change (like renaming a function) without updating a million tests.