I'm writing a client library against an API that communicates using UDP through a socket connection. I'm trying to write tests as I go however I'm running into a few problems.
- Should I just build a testing server and start that up in my test helper? I don't want to hammer the external servers when running my tests.
- Or should I just mock the hell out of the UDPSocket lib and test against that?
My problem with the first option is that I then have to keep up with changes to the API and make sure that my dummy server emulates them, which could lead to false positives and brittle tests. And my problem with 2 is that excessive mocking could also lead to brittle tests in case anything in UDPSocket changes.
However I've been spiking on this for a couple of days now and having big gaps of missing test coverage is making me a bit nervous. What would you do?
thanks