jeudi 7 mai 2015

Testing twisted protocol

I have a very basic client and server protocols developed using Twisted. Twisted allows to unittest them independently and provides nice testing utils such as the StringTransport for this.

However, let's say I want to test the protocol works fine. For instance, I want to test that when the server receives a certain message, will reply to the client in some specific way. What is the best way to do that using trial and the utils in Twisted? I am currently launching processes to run them, but then I lose the access to their objects and I need to dump their states in a file to validate the correct behaviour. I don't think this is a clean way to do it. It would be much better to use a StringTransport that simulates a TCP connection from the client to the server. How do twisted developers normally test this?

Aucun commentaire:

Enregistrer un commentaire