[TIP] Capture HTTP traffic

Alfredo Deza alfredodeza at gmail.com
Fri Nov 5 06:30:49 PDT 2010

On Fri, Nov 5, 2010 at 9:09 AM, C. Titus Brown <ctb at msu.edu> wrote:

> On Fri, Nov 05, 2010 at 08:38:25AM -0400, Alfredo Deza wrote:
> > On Fri, Nov 5, 2010 at 4:52 AM, Alex <alex.lavoro.propio at gmail.com>
> wrote:
> > > The best solution would be a high-level (HTTP-level) Python
> > > module/wrapper for 'pycap', which operates in 'packet' level. This
> > > said module use pycap to capture and filter HTTP requests and returns
> > > the result in a more Pythonic data structures. This module should
> > > start a thread which captures HTTP requests while the test case is
> > > being executed.
> > >
> > > I cannot find anything which does what I've just describe. Please
> > > correct if I am wrong.
> > >
> > >
> > I think no one has mentioned it in this thread, but to test our
> application
> > we use
> > TestApp [1] from WebTest [2] (by Ian Bicking) which covers most of what
> you
> > mention.
> >
> > All requests are captured, and you can evaluate any parts of the
> response.
> >
> > We hook WebTest into the setUp method and we get full isolation from
> > other tests that are running, we even got py.test to run in parallel with
> > this same method achieving total isolation from other tests.
> Hi Alfredo,
> Alex has specified his problem in such a way that WebTest can't solve it,
> unless I'm missing something... WebTest is another Python-specific
> solution,
> based around WSGI, right?
> Yes WebTest is based around WSGi but as I understood it, Alex mentioned:

"The target to be tested is a C++ application, so  Python tools like
wsgi_intercept, twill, mechanize do not apply."

Which doesn't apply (correct me if I am wrong)  to a WSGI application
around WebTest.

I just don't see how a C++ app would not be able to call it so he can

For example, when we test external API's that do not have a sandbox and we
need to make HTTP calls that return certain responses, we create something
similar to a WSGI app (in some cases we use Bottle) that has WebTest around
it, calls and responses are captured no matter where you are starting the
call from.

But then again, I might be wrong applying those solutions to Alex's problem

> best,
> --titus
> --
> C. Titus Brown, ctb at msu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20101105/0d56ea7f/attachment-0001.htm>

More information about the testing-in-python mailing list