I just started using zope.testbrowser and zope.testrecorder for doing
integration tests. The case study is Ploneboard, the long-overdue
message board for Plone, which has a workflow maze to compete with the
best of them. Permissions control actions like reply, delete, edit and
approve/moderate, which vary according to the different types of forum
(e.g. moderated vs. non-moderated), and forms can get pretty complex.
zope.testbrowser gives us a way to sanity-check all that - I love it :)
There are three features I've found myself missing, though.
o In zope.testbrowser, I sometimes need to be quite specific; for
example, let's say I need to test that user A can see an 'edit' button
on his own post, but not on the post by user B, both of which appear on
the same page.
In this case, having the ability to select nodes by XPATH would be
incredibly useful - both for getControl()/getLink(), and for doing
assertions (fail if/unless this node exists). I imagine an existing
library would be available to make this reasonably easy to implement?
o In zope.testrecorder, the ability to add comments that become
DocTest comments is a stroke of genius. What I'd love to see, though, is
the ability to add assertions for text. Basically, if I could mark some
text in the browser and have that become a statement like
'...some text in the browser...'
... then that would go a long way towards making the post-processing of
the rendered DocTest a very minimal exercise.
o Finally, zope.testrecorder always records full URLs, e.g.
http://localhost:8080/test/foo. It would be nice if it could render
those in the doctest at least with some variable substitution, e.g.:
>>> baseUrl = 'http://localhost:8080/test'
>>> browser.open('%s/foo' % baseUrl)
That way, I could make sure that in integration tests, the baseUrl was
always valid and consistent without needing to do a lot of
Zope3-dev mailing list