3 ms·
Mocking networked services is something very much worth doing because you can then check you’ve set timeouts correctly, handling incomplete or junk responses gr
by laumars 6y ago
Mocking networked services is something very much worth doing because you can then check you’ve set timeouts correctly, handling incomplete or junk responses gracefully etc. Those are the kind of hidden problems that can bite you on production deployments.
- nottorp 6y agoYou can mock networks all you want and you'll still cover only what you can think of. It will always break on the user's internet, because it's too diverse to predict. Doesn't mean you can't have some networking unit tests, just that you shouldn't believe in them too much. Edit: you said services. You thinking of server? I'm thinking of clients.
- tremon 6y ago"mocking networked services" is exactly what you would do when testing clients. And it doesn't have to be a static mock. It's not too hard to inject a fuzzer in your mock service response, although that's probably left to a separate testing routine, and not part of your unit test setup. But if you have no mock for your network service, you can't fuzz it either.