(Resending, since Google Groups is in a snit and didn't want to accept my primary email address, insisting I use the @gmail.com one.)
On Wed, Apr 08, 2009 at 08:25:49AM -0700, Jonathan Vanasco wrote:
> I've found unit-testing to be not worth it -- it always passes, but I
> find tons of errors on the integration w/sessions and html side.
Unit tests alone aren't sufficient, as you've discovered. But I suspect
that if you went to the other extreme, you'd end up disappointed as
well, but for different reasons:
* testing everything with just integration/functional tests makes the
test suite become very slow after a couple of years
* it's hard to trigger corner cases of inner parts of your implementation
functions/methods if you do not invoke them directly, but have to
find and simulate a real use case that would depend on them
A healthy mix of unit and integration/functional tests is best.
> does anyone have good pointers for automating that sort of testing ,
> and integrating it into the pylons suite?
WebTest ought to be sufficient for testing your session code, if you use
it's pseudo-browser API (i.e. response.submit(), response.click() etc.)
instead of performing standalone requests. The default Pylons project
template creates functional test skeletons for your controllers based on
WebTest.
Testing JavaScript is a bit harder. I've seen how people integrate
JavaScript *unit* tests into their py.test test suite, and I've used those
ideas to define a unittest.TestCase subclass that spawns a browser
window and drives it to run JsUnit-compatible test suites in Firefox or
MSIE (under WINE, no idea if it would work in a real Windows OS). This
is not, however, a real integration test involving a real browser and
your app.
Selenium is the most popular answer to that question. I've seen people
integrate Selenium into their own again more-or-less-unittest-compatible
test suites using zc.selenium. I've no direct experience using Selenium
with Pylons and driving it from Nose.
Marius Gedminas
--
MCSE == Minesweeper Consultant / Solitaire Expert
signature.asc
Description: Digital signature
