[Zope] about unit test

Gregoire Weber gregoire.weber@switzerland.org
Mon, 17 Mar 2003 22:54:19 +0100


Hi,

I'm writing unit tests for a CMFCollection (a CMF product) and
the following works for me:

    1. Download testrunner.py from
       <http://www.zope.org/Members/shh/TestRunner/index_html>

    2. Read the instructions from the above page.
       (I renamed and copied the downloaded testrunner.py
       to /SoftwareZopeRoot/utilities/testrunner2.py)

    3. All my unit test files begin with the code below.

    4. I start my unit tests from the products directory:

       - cd pathToINSTANCE_HOME/Products/MyProduct'

       - /SoftwareZopeRoot/utilities/testrunner2.py -iaq

    5. done.

How to write unit tests look at the instructions Dieter gave
you.

--------------------------------------------------------------
import Zope
try:
     Zope.startup()
except NameError:  # pre Zope 2.6.1
     pass

from unittest import TestCase, TestSuite, makeSuite, main

from Products.ProductUnderTest import ModuleUnderTest # etc.

# test code here

At 12:22 17.03.2003 +0800, =3D?gb2312?q?Chen=3D20Fu?=3D wrote:
>Hi!
>I download several products and find some of them own
>a "tests" directory. I think there are the files for
>unit test. Any guru can show me how to do a unit test
>in zope? Maybe you can give me a link to read :)
>Thanks!

_____________________________________
Gr=E9goire Weber
mailto:gregoire.weber@switzerland.org