Whenever having to test my app which basically is some kind of communication via sockets with external devices, the device itself has to be available and connected.
I would like to ask,if there is a way to do the testing offline in some kind of simulation mode?
For instance, redirecting the socket communication to some kind of stored file. And the file itself is a log of a previous session with the real device stored in an appropriate structure. Of course one could only simulate a recorded session, but that would help a lot already.
thanks!
You should have a look at
netcat. If you have a record of your “session” in a file, you can usencto “play it back” on a socket with something like:You can then connect to that port number with
telnetand you’ll see the session data coming in.(You can do it the other way around too, i.e. have
ncconnect to your app and replay the session.)