python - using pyunit on a network thread -


I have been tasked with writing a unit test for a suite of network software written in Python. It is very easy to write units for message builders and other static methods, but when it comes to writing a test for threads omitted from the network, I have killed a wall. For example: It connects to the server, it may be any port, and I want to be able to test the ability to add multiple ports (in sequence, not parallel), without actually running multiple servers What is a good way to approach this? Probably can the server build a test and make the destruction part? Some tell me that I should have a simple answer.

I think the unit test methods are for methods of thread threads, but I can not find any.

I try to present an existing factory in my existing code to create a socket object is ready. Then in an imitation factory, a test pass which creates fake chairs that are connected to only one server (or not for error cases, which you also want to check, do not?) And to prove the message traffic Login to know that your code has used the correct ports to connect to the right type of server.

Try not to use the thread yet to make the test easier.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -