[Zope3-Users] testing setup
hello, I'm having problems trying to write some tests for my code so... can someone tell me (or point me to) how to setup the infrastructure required for running unit -and specially- functional tests? I've created a 'tests.py' which looks something like this: ## def test_suite(): return unittest.TestSuite(( DocFileSuite('app.py') # or 'README.txt' or whaterver... )) if __name__ == '__main__': unittest.main(defaultTest='test_suite') ### the test.py in the Zope distribution doesn't run my tests because they don't live inside the zope directory but I can still run them by cd'ing into my directory and doing python tests.py the problem is that now I'd like to create some functional tests like creating an object with my AddForm... I know there is a testbrowser, and I think I've read of another possibility to somehow record a human interaction once, and then reply it in the test, and somewhere I've seen a TestRequest as well...so what is the right way to do this through-the-web tests? right now I'm trying to get the testbrowser to work, but all tests fail because the server is not running, so how do I tell the testing framework to start the zope server so that the testbrowser can connect to it? would the testing framework create a new instance with a clean database and remove it after the tests (or use a memory database), or just use the normal Data.fs ? thanks a lot for any help you can give me, luis ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] testing setup
luis ha scritto: I know there is a testbrowser, and I think I've read of another possibility to somehow record a human interaction once, and then reply it in the test, and somewhere I've seen a TestRequest as well...so Look for zope.testrecorder in svn what is the right way to do this through-the-web tests? You record a session with testrecorder and generate python code; then you put that in a doctest and modify it to suit your needs right now I'm trying to get the testbrowser to work, but all tests fail because the server is not running, so how do I tell the testing framework to start the zope server so that the testbrowser can connect to it? No, you don't need the zope server to run for the tests. would the testing framework create a new instance with a clean database and remove it after the tests (or use a memory database), or just use the normal Data.fs ? It doesn't touch your Data.fs ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] testing setup
On Wed, 2006-07-19 at 00:21 +0200, luis wrote: ... the problem is that now I'd like to create some functional tests like creating an object with my AddForm... I know there is a testbrowser, and I think I've read of another possibility to somehow record a human interaction once, and then reply it in the test, and somewhere I've seen a TestRequest as well...so what is the right way to do this through-the-web tests? I prefer to use testbrowser:: from zope.testbrowser import Browser browser = Browser() browser.open('http://localhost/contents.html') You'll probably need a manager to do anything at all:: from zope.testbrowser import Browser browser = Browser() browser.addHeader('Authorization', 'Basic mgr:mgrpw') browser.open('http://localhost/contents.html') See zope.testbrowser.README.txt. Yes, testbrowser creates a clean database and cleans up after itself (to the best of my knowledge). Regards, Darryl right now I'm trying to get the testbrowser to work, but all tests fail because the server is not running, so how do I tell the testing framework to start the zope server so that the testbrowser can connect to it? would the testing framework create a new instance with a clean database and remove it after the tests (or use a memory database), or just use the normal Data.fs ? thanks a lot for any help you can give me, luis ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] testing setup
On 7/19/06, luis [EMAIL PROTECTED] wrote: hello, I'm having problems trying to write some tests for my code so... can someone tell me (or point me to) how to setup the infrastructure required for running unit -and specially- functional tests? These recipes may be usefull: http://www.zope-cookbook.org/cookbook/recipe06 http://www.zope-cookbook.org/cookbook/recipe07 Regards, Baiju M ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users