[ZODB-Dev] Re: Snapshotting state with DemoStorage

Martin Aspeli optilude at gmx.net
Wed May 28 03:48:46 EDT 2008


Jim Fulton wrote:
> Look at zc.selenium, which does this.

Thanks!

I'm struggling a little bit with making the leap to Zope 2 and 
ZopeTestCase, though. I think the approach zc.selenium takes is a bit 
more complex than what I need, because it seems to be doing some of the 
Selenium controlling itself. The way I've used Selenium in Java before 
uses a simple client driver (which has a Python version) talking to the 
Selenium RC, which deals with opening the browser etc.

In this case, we used a base class for JUnit tests that did a database 
clean-down to a known good state before each test run. If I can do the 
basic test setup in a standard layer and do the "reset database to the 
layer's setup state" before each test, I think we'd be good. I don't 
particularly need to do the reset from within a Selenium test (i.e. with 
a browser URL) or run tests from an HTML table.

I think the main problem is that I'm not terribly familiar with how 
DemoStorage works, or how the Zope server (in a test case) ends up 
getting its database. I'm worried that I may be asking the "wrong" 
questions here, but to my mind, the three questions would be:

  - how can I use DemoStorage to snapshot a known state and then return 
to it at all

  - how can I ensure that this is the storage that the Zope server sees

  - how can I actually access a server that's running inside a 
ZopeTestCase over a URL, i.e. ensure that it binds to a port and serves 
requests for the duration of the test run

Thanks,
Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the ZODB-Dev mailing list