Ian Bicking: the old part of his blog

Best of the web app test frameworks comment 000

Yes, that's much better indeed. Now I can't remember quite why I wrapped my application in an object, instead of using a browser object as the central metaphor. In the end it's not that much different, except that some things like "back" don't exist for an application, and it's not as stateful (which has pluses and minuses).

It looks like zope.browser actually uses HTTP requests? WSGI would definitely be nice, as it would allow in-process requests, something that I have found very convenient. Seeing the framework's nice-formatted HTTP exception reports is not particularly useful when you are running automated tests. I also like that I can send out-of-band information; for instance, I use REMOTE_USER to set the username (or sometimes put it in test-specific configuration), instead of simulating a full login. Then I don't need fake logins, or to put my password in the tests, etc.

Another feature that I added to paste.fixture -- in part after looking at Rails' and CherryPy's tests -- is the framework hooks which allow frameworks to record internal information into the response object. This means you can simultaneously test the full-stack rendering and response, and internal details like what variables were passed to the template. Obviously you can only do this in-process.

Comment on Re: Best of the web app test frameworks?
by Ian Bicking


It looks like zope.[test]browser actually uses HTTP requests?

For Zope 3 it directly communicates with the in-process publisher. Not only is it much faster that way, you can have non-testbrowser code do other types of tests (as you mention below). There's also a generic browser object you can use that makes connections over the wire for testing "remote" applications or doing non-testing tasks.

I intend on integrating the same way with WSGI; zope.testbrowser would actually be a WSGI server into which you would plug the application(s) under test.

Of course this fits into my desire to make Zope 3 paste.deploy compatible.

# Benji York