On Tue, Oct 24, 2000 at 04:35:58AM -0700, Butch Landingin wrote:
So I do have some questions about how you intend the ZUnit to be used... e.g. -- lets say I'm developing a Zope Application... I begin by writing the Python code interface, then I start writing the PyUnit test... in the the Setup section, I put in the code that hooks me into the Zope ZODB, installs the product, sets the properties, etc.; in the test section, I can get to the object, test my assertions, etc... and in the TearDown -- I back out my changes, etc... Then I add this test to my Test suite...etc., etc...Then to run this test, I...do...what?
Well, I imagine it like this: Setup: You create an object in the ZODB and set properties etc Test: Make the assertions Teardown: Only necessary if you make other unrelated changes, because ideally ZUnit would already discard your objects after the test is run In your Product, you would (like usual with PyUnit) implement a function (in the place of your choosing) which returns a newly-allocated TestSuite. Let's call this the "creator function". As for your question, how do you run it, this is exactly the difference between the two ZUnit sub-proposals. ZUnit Product: You create a TestRunner object somewhere (anywhere) in your ZODB. One of its properties, "suite", is the full Python module/object path of the creator function. When you click "run the tests" in the TestRunner, it creates an instance of TestResults, which runs the tests and accumulates the results; clicking on it later will format the results for you. ZUnit mods to the Product-related classes: On your Product's __init__, you give the creator function as the argument of a new function context.registerTests. Then on the Product object in the Control Panel, there will be a new tab "Unit test" or something. Clicking on it will give you a list of existing TestResults objects and a button to run the tests and create a new TestResults (more or less the same semantics as the TestRunner, but on the Control Panel). The big difference is (creating the TestRunner in an arbitrary location in the ZODB then setting the name of the creator function) versus (passing the creator function on Product initialization and running in the Control Panel). []s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar