[Twisted-Python] A new testing strategy for protocols
Itamar Shtull-Trauring
twisted at itamarst.org
Sun Mar 3 00:41:13 EST 2002
A long time issue we've had is how to test protocols under "real"
circumstances. For DNS testing, I decided to do just that - see the code
in twisted/test/test_names.py.
Basically, I start a server listening using UDP, and have a client
connect to it, all within the testing code and automatically. It works
pretty well, after a bit of debugging. Data is pushed by calling
main.iterate().
Now, in a lot of cases twisted.protocols.loopback may be good enough,
but this approach is really necessary for thorough testing in certain
cases. FTP leaps to mind, but also if we want automated testing of TOC
or OSCAR clients against real servers.
One drawback at least is that these tests will fail miserably on Jython
(main.iterate on Jython doesn't push data), so I'm probably going to add
code that makes sure they don't run at all on Jython.
Another drawback is the related issue that I'm also testing DNS queries
against real servers - this assumes a working net connection.
More information about the Twisted-Python
mailing list