Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have got a testing suite for an applications that performs lots of HTTP requests.

This number changes each time you run the tests. Is there a Unix command or program that "listens" to another program counting its http requests?

share|improve this question
up vote 0 down vote accepted

Any packet sniffer will do that for you. Check out tcpdump or wireshark. You'll have to setup a few filters on the data they collect, but that's easy.

share|improve this answer
how would you tell which requests are coming from the application being tested? – Gilles Aug 8 '10 at 16:32
Do you know the destination address you're testing? you can probably tell which port your testing application is using. Filter by these criteria also – bryan Aug 8 '10 at 17:44
Yup I know the address. Tests always do POST requests to a unique URL – dgraziotin Aug 9 '10 at 9:24
wireshark worked fine. Now I know that my test suite performs and checks quite 200 XML-RPC calls :) Thank you! – dgraziotin Aug 9 '10 at 16:24
  • You can trace your application's system calls with truss/trace/strace/... (the name, command line syntax and output format is OS-dependent), and watch for connect calls. If your application also uses non-HTTP networking you may have to work a little harder to filter the relevant connections.

  • You can use LD_PRELOAD or a debugger to modify the function that creates the HTTP connections. But this may be too intrusive for a test.

  • You can put a simple proxy between your application and the web. Both perl and python come with libraries that would make it a 10–20-line program. This is the approach I'd prefer unless you're specifically testing your application's behavior against a specific server or proxy.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .