in reply to Web testing without the web server.
You can't exactly do that. When you test a web application you're testing its responses to GET/HEAD/POST/ETC and that it responds to them correctly with good headers etc. To test web applications you necessarily have to test the transport layer with it and doing that without a webserver of some kind implies writing code that would mimic a webserver's behavior which is goofy (well, not goofy but why we have the stuff Corion mentioned).
I understand your goal though -- it's the unit versus app test problem -- and Catalyst::Controller::REST might fit (part of) the bill. It can be set up so that accept headers dictate how the response is returned. So your tests, for example, could say they'll only accept YAML and your controllers which serve nice XHTML for browsers (which say they accept it) would serve the same stash data that builds the template as YAML instead.
I think in the end though you really have to test the web app directly, your underlying code is stuff like DBI.pm and URI.pm which is well tested already, and if you have JS you'd best use Selenium (which writes 90% of the tests automatically) so starting with a pure unit/in:out testing approach might only (probably will, I'd say) end up duplicating work and making tests redundant.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Web testing without the web server.
by kyle (Abbot) on Mar 27, 2009 at 16:51 UTC |