I am writing a client library against an API that uses UDP through a socket connection. I am trying to write tests, but I am running into some problems.
- Should I just build a test server and start my test assistant?
- Would I want to mock hell against the UDPS socket and test it against it?
My problem with the first option is that I have to live with the changes in the API and make sure my dummy server emulates them, which leads to false positive and brittle tests. You can. And my problem with 2 is that with excessive joke, there can be brittle tests even if there is any change in the UDPs.
However, I'm spying on it for a few days and the missing test coverage for me is a bit nervous. What will you do?
Thanks
I duplicate this type of thing. At any time you are communicating with an external host, then you probably want to fake. It does not fully understand the reliability of internet connectivity for your unit tests.
I would also advise against the difficulty of creating a sophisticated emulated server. Without writing logic, there is very much the same thing in joke. Either way, you are not talking to the real thing.