< Day Day Up > |
The entire testing procedure is beyond the scope of this book. Following is a short summary of how the tests proceed. The client and I developed our testing strategy as the design was being developed ("Plan for Testing"). Because we applied the guidelines of Extreme Separation, there are only a few methods to test in each class.
You can run the second and third tests in a variety of environments by varying the implementations of TextMessageDispatcher , ClientEnvironment , and ServerEnvironment . The classes that implement interfaces allow for mixing and matching of implementations during testing ("Build Flexibility for Testing"). Both ClientMessageDispatcher and ServerMessageDispatcher implement the MessageReceiver . To test that the handle( ) method for each Message works correctly, do_particular_operation( ) can call the implementation provided by ServerMessageDispatcher directly. Testing can proceed without involving the network or decoding/encoding text. Both ClientSocket and ServerMessageReceiver implement TexTReceiver . ClientMessageDispatcher can talk directly to the ServerMessageReceiver implementation. Now the flow can be tested with the addition of conversion to and from text. Test versions of TextSender and MessageReceiver can be created that return failures to see if do_particular_operation( ) responds correctly. Testing is about being able to alter one little thing and see the differences in the results. Regardless of how things are hooked up (in any one of three ways), the results should be the same, if there is no network failure. With the flexibility in the design, you can test do_particular_operation ( ) multiple ways:
|
< Day Day Up > |