Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have had good luck with a record/playback model. That is:
  • log the traffic (at either a semantic level or a network level, depending on the particulars of the application), if possible, from a real scenario from your "control" code base (that is, either set up a monitor between the client and the server, or alter the client or server to embed a logging capability).
  • make a mock client which can replay the same traffic to the server, and track the output from the server, also vice-versa with a mock server (or only use a mock client if you only want to test the server, or vice-versa).
  • use the "control" logs obtained from the logger/monitor, and the mock client/server to play the same traffic back against the test codebase, and, likewise monitor it.
  • diff the control logs versus the test logs.
A simple example would be to test a web server by taking your real web logs (possibly altered to include more information than would normally be included, like, for example, the POST string), and running them through a script which made an LWP request for each entry in the web log. Then, of course, diffing the HTML.

Of course, the method is generally applicable to anything that allows you to spoof the client or the server (and I've used it for more than just web servers), but web servers make a nice example. A more general method would be simply to trap all the traffic on the socket and write it to a file (tracking what is server talking and what is client talking), and then play the one sides half of that conversation into the other side by, well, basically pasting it into a telnet window :-)

This model is very helpful for situations where you want to make sure that no unexpected changes occured between your control and your test version. Obviously, you'll want to identify differences and decide whether or not they are expected differences. It's often useful to munge the diff (systematically remove approved differences), and/or to munge the input's to the diff (likewise, as a way to systematically remove differences... but actually by making the inputs more similar, rather than by clipping the output of the diff, which can often be more difficult).

------------ :Wq Not an editor command: Wq

In reply to Re: Testing a Client-Server Application by etcshadow
in thread Testing a Client-Server Application by dreadpiratepeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found