[Zope3-Users] Re: Functional Tests

Philipp von Weitershausen philipp at weitershausen.de
Wed Aug 30 01:35:07 EDT 2006


David Johnson wrote:
> I decided it’s about time to use functional tests.  I’ve been setting
> them up with the following code and I get the
> following error (I’ve never gotten it to work):
> 
>  
> 
> import time
> 
> import unittest
> 
>  
> 
> from zope.app.tests.functional import BrowserTestCase
> 
> from merchantlink.app import MerchantLink
> 
>  
> 
> class MerchantLinkTests(BrowserTestCase):

Note that the preferred way of simulating a browser client is to use
zope.testbrowser in a doctest nowadays. See zope.testbrowser/README.txt
for an extensive documentation on TestBrowser.

> def test_suite():
> 
>     return unittest.TestSuite((
> 
>          unittest.makeSuite(MerchantLinkTests),
> 
>          ))
> 
>  
> 
> if __name__=='__main__':
> 
>     unittest.main(defaultTest='test_suite')
> 
> Results:
> 
> ...
> 
> IOError: [Errno 2] No such file or directory:
> '/home/djohnson/dev/whiteboard/lib/python/merchantlink/browser/tests/ftesting.zcml'

Functional tests are supposed to be run by the test runner from your
instance home:

  $ cd /home/djohnson/dev/whiteboard
  $ bin/test -f -s merchantlink.browser

The -f flag tells it to run all tests but unit tests.

Philipp



More information about the Zope3-users mailing list