[Zope] Re: zope.testbrowser, how to?

Philipp von Weitershausen philipp at weitershausen.de
Wed Feb 28 13:22:48 EST 2007


Basil Shubin wrote:
> Basil Shubin wrote:
>> Hi friends,
>>
>> I want use zope.testbrowser for testing my sites, but before write it 
>> as DocTest I want execute each statemnt interactively in python shell. 
>> I don't know any way to see where it's works, what value it returns, 
>> what error I can get and how this error should looks is python... It's 
>> why I want check it in python shell.
>>
>> What the problem?
>>
>> First, if execute following code in python shell:
>>
>>  >>> from zope.testbrowser import Browser
>>  >>> browser = Browser()
>>  >>> browser.open('http://localhost/Plone')
> 
> but if I have use this instead above code:
> 
>   >>> from zope.testbrowser.browser import Browser
>   >>> browser = Browser('http://localhost:8080/Plone')
> 
> everything works!

That's because zope.testbrowser.browser.Browser opens real HTTP 
connections. zope.testbrowser.Browser uses Zope 3's functional test 
framework.

If you want to use the test browser for functional tests in Zope 2, use 
Products.Five.testbrowser.Browser.

-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5



More information about the Zope mailing list