[Zope3-dev] Re: XPATH in zope.testbrowser, assertions in zope.testrecorder

Martin Aspeli optilude at gmx.net
Sat Jun 24 20:59:12 EDT 2006


Benji York wrote:
> Martin Aspeli wrote:
>>   o In zope.testbrowser, [snip] having the ability to select nodes
>  > by XPATH would be incredibly useful
> 
> Yep, I and others have thought the same thing.

Cool. Philipp mentioned that lxml may have a nice API for this, too.

>> I imagine an existing
>> library would be available to make this reasonably easy to implement?
> 
> With ElementTree going into Python 2.5, I suspect testbrowser will grow 
> XPath support.

Great! (of course, if we could have it sooner....) :p

>>   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.
> 
> We've considered that too.  Patches welcome. :)

I looked at zope.testrecorder and thought, hey, that looks simple! Then 
I saw the .js file... ;-)

Realistically, I don't think I'm likely to have time to figure out how 
this works and make changes in the near future (too many other 
projects). If I can find the time (or find someone else who has the 
necessary skill) I would of course love to help out.

>>   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.:
> 
> Good idea.  The post-record screen (where you choose either Selenium or 
> testbrowser output) would be a good place for that.  You could choose 
> any substitution you wanted for the host and port portion of the URIs, 
> defaulting to whatever the actual value was. 

Yeah, that was my thinking. Actually, I'd prefer if it just rendered it 
as a '%s/foo' % base_url, where base_url was a variable. That way the 
test case could do e.g. base_url = self.portal.absolute_url() and we 
wouldn't have to hardcode anything.

> We would have to handle 
> the case when more than one base was recorded during the session.

True. It wouldn't be too hard to go through the urls in use and present 
a table of text boxes where you could map each to a variable (or leave 
as default), I guess.

Martin



More information about the Zope3-dev mailing list